Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
[Solved] Making Any Command persistent across reboots?
-
- Posts: 485
- Joined: 2009-07-04 06:32
- Location: Home: Barrackpore and Mysore
- Has thanked: 5 times
[Solved] Making Any Command persistent across reboots?
Query: Making Any Command persistent across reboots?
Last edited by bkpsusmitaa on 2018-09-10 06:11, edited 1 time in total.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
-
- Posts: 485
- Joined: 2009-07-04 06:32
- Location: Home: Barrackpore and Mysore
- Has thanked: 5 times
Query: Making Any Command persistent across reboots?
I searched the forum with the string, "command persistent reboots".
Found three threads, but not relevant.
Then used Google to more thoroughly search the Debian Forum with the string without the ": "initiali manag service"
Can I use something similar to rc.local which is used to automate a SERVICE? If I wish to run a command such as every reboot?
I am guessing that this could be managed using rc.local but am not experimenting with it at present, for the fear of damaging my system.
I know that when we cross-over from one to another init level, the scripts in rc1.d, rc2.d and so on are executed in each of those init levels. For example, the README in rc5.d says:
But I need to know about intialising a particular process.
There is a tutorial at the following link but uses MySQL as an example. So I can't follow it.
How To Configure a Linux Service to Start Automatically After a Crash or Reboot
Another relevant material at:
Initializing and Managing Services in Linux: Past, Present and Future
I don't see the objective to read the entire pages for a simple solution. But will if no one ultimately helps. But I must offer an opportunity for my fellow posters here. For a simple solution.
Any help?
Found three threads, but not relevant.
Then used Google to more thoroughly search the Debian Forum with the string without the ": "initiali manag service"
Can I use something similar to rc.local which is used to automate a SERVICE? If I wish to run a command such as
Code: Select all
modprobe snd-aloop
I am guessing that this could be managed using rc.local but am not experimenting with it at present, for the fear of damaging my system.
Code: Select all
/etc/rc.local
The init.d README says about: update-rc.d... ... ... ... ... ... ... ...
The scripts in this directory are executed each time the system enters
this runlevel.
The scripts are all symbolic links whose targets are located in
/etc/init.d/ .
... ... ... ... ... ... ... ...
But I need to know about intialising a particular process.
There is a tutorial at the following link but uses MySQL as an example. So I can't follow it.
How To Configure a Linux Service to Start Automatically After a Crash or Reboot
Another relevant material at:
Initializing and Managing Services in Linux: Past, Present and Future
I don't see the objective to read the entire pages for a simple solution. But will if no one ultimately helps. But I must offer an opportunity for my fellow posters here. For a simple solution.
Any help?
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: Query: Making Any Command persistent across reboots?
^ This is an example of an XY problem: you can run commands at boot by using a systemd unit file[1] but in this case you just need to add the module name to /etc/modules for it to be loaded automatically.bkpsusmitaa wrote:I wish to run a command such asevery reboot?Code: Select all
modprobe snd-aloop
But this may not actually solve your problem because you haven't told us why you want to load that module or what the actual problem is...
[1] http://0pointer.de/blog/projects/system ... ins-3.html
deadbang
- sunrat
- Administrator
- Posts: 6412
- Joined: 2006-08-29 09:12
- Location: Melbourne, Australia
- Has thanked: 116 times
- Been thanked: 462 times
Re: Query: Making Any Command persistent across reboots?
Those links tell you almost everything you need to know. You can run from rc.local or alternatively use a cron job. Debian uses systemd so you could also write a systemd service file.
What command do you want to run? If it's just to load a module as in your example, just put the module name in /etc/modules or create a file in /etc/modules-load.d/
What command do you want to run? If it's just to load a module as in your example, just put the module name in /etc/modules or create a file in /etc/modules-load.d/
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!
-
- Posts: 485
- Joined: 2009-07-04 06:32
- Location: Home: Barrackpore and Mysore
- Has thanked: 5 times
[Solved] Making Any Command persistent across reboots?
Thank you, sunrat. You rock. My post didn't contain just any example. Rather, a real scenario.sunrat wrote:What command do you want to run? If it's just to load a module as in your example, just put the module name in /etc/modules or create a file in /etc/modules-load.d/
One problem though (think it could be overcome easily). The normal playback option for my system is now gone. Which means the said module has to load after runlevel 5 is reached.
Will you kindly tell me, had I tried to load the said module using rc.local, how could I?sunrat wrote:Those links tell you almost everything you need to know. You can run from rc.local or alternatively use a cron job. Debian uses systemd so you could also write a systemd service file.
sunrat, I am aware that since Debian 8, Debian uses systemd. But I use Lenny because it helps me with all my daily work. I have to again put in some extra time in setting up my system for installing the later Dabian.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
- sunrat
- Administrator
- Posts: 6412
- Joined: 2006-08-29 09:12
- Location: Melbourne, Australia
- Has thanked: 116 times
- Been thanked: 462 times
Re: [Solved] Making Any Command persistent across reboots?
What does this mean? Why is the "normal playback option" gone and what is it?bkpsusmitaa wrote:The normal playback option for my system is now gone. Which means the said module has to load after runlevel 5 is reached.
It does indeed sound like an XY problem. Tell us what you are trying to achieve and you may get more focussed replies rather than random guesses based on incomplete data.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!
-
- Posts: 1100
- Joined: 2016-01-07 12:25
- Has thanked: 5 times
- Been thanked: 16 times
Re: [Solved] Making Any Command persistent across reboots?
It sounds like cron would be ideal for this, simply add the command and you should be good to go, if the command needs to be run as root then you should add it to roots cronWhich means the said module has to load after runlevel 5 is reached.
Code: Select all
crontab -e
-
- Posts: 485
- Joined: 2009-07-04 06:32
- Location: Home: Barrackpore and Mysore
- Has thanked: 5 times
Re: [Solved] Making Any Command persistent across reboots?
My dear sunrat, it is not an xy problem. Please don't let your judgement become influenced by others' opinions.sunrat wrote:What does this mean? Why is the "normal playback option" gone and what is it?bkpsusmitaa wrote:The normal playback option for my system is now gone. Which means the said module has to load after runlevel 5 is reached.
It does indeed sound like an XY problem. Tell us what you are trying to achieve and you may get more focussed replies rather than random guesses based on incomplete data.
Kindly look at the output of running at runlevel 5 the following commands without loading the snd-loop using the module file:
Code: Select all
sudo aplay -l
Code: Select all
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: ALC268 Analog [ALC268 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
Code: Select all
sudo modprobe snd-aloop
Code: Select all
sudo aplay -l
Code: Select all
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: ALC268 Analog [ALC268 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
Subdevices: 7/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
Last edited by bkpsusmitaa on 2018-09-11 04:33, edited 2 times in total.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
-
- Posts: 485
- Joined: 2009-07-04 06:32
- Location: Home: Barrackpore and Mysore
- Has thanked: 5 times
Re: [Solved] Making Any Command persistent across reboots?
Thanks, Dai. Earlier I used to use cron, but later on didn't have the need.Dai_trying wrote:It sounds like cron would be ideal for this, simply add the command and you should be good to go, if the command needs to be run as root then you should add it to roots cronCode: Select all
crontab -e
Yes, cron will fit the bill perfectly.
However, the need for cron is not very necessary. It just needs using the ↑ keystroke in the lxterminal, as that is usually the last command in the lxterminal. I could use a script too, to just use my mouse to activate snd-aloop.
Could you help me plan a loading of sudo modprobe snd-aloop with cron a minutes after my runlevel5 desktop session has commenced? How should this script be? For 1min after desktop session has commenced?
Thanks for your post. I acknowledge your intent to help. And appreciate it.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
- sunrat
- Administrator
- Posts: 6412
- Joined: 2006-08-29 09:12
- Location: Melbourne, Australia
- Has thanked: 116 times
- Been thanked: 462 times
Re: [Solved] Making Any Command persistent across reboots?
Sorry hope I didn't offend. The reason I asked about XY problem is I still don't understand what you are trying to achieve.
Do you not have sound if snd-aloop is not loaded? snd-aloop provides virtual soundcards which can be used to pipe audio from one application to another. It should not be needed just to get sound from the default card.
Is this an old NForce3 motherboard? I recall they can be rather pesky trying to get sound to work.
Do you not have sound if snd-aloop is not loaded? snd-aloop provides virtual soundcards which can be used to pipe audio from one application to another. It should not be needed just to get sound from the default card.
Is this an old NForce3 motherboard? I recall they can be rather pesky trying to get sound to work.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!
-
- Posts: 485
- Joined: 2009-07-04 06:32
- Location: Home: Barrackpore and Mysore
- Has thanked: 5 times
Thanks, sunrat ...
I wasn't. Not for my compatriots.sunrat wrote:Sorry hope I didn't offend.
Nothing complicated. Take my words on their facevalue.sunrat wrote:The reason I asked about XY problem is I still don't understand what you are trying to achieve.
No, I have sound. I don't have recording. You would please need to visit my other thread, where the matter is detailed.sunrat wrote:Do you not have sound if snd-aloop is not loaded? snd-aloop provides virtual soundcards which can be used to pipe audio from one application to another.
Yes, that I learnt gradually.sunrat wrote:It should not be needed just to get sound from the default card.
Yes, you are correct. The details about the card are in the other post.sunrat wrote: Is this an old NForce3 motherboard? I recall they can be rather pesky trying to get sound to work.
Finally, you rock. Even more.
Last edited by bkpsusmitaa on 2018-09-11 11:30, edited 1 time in total.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
-
- Posts: 1100
- Joined: 2016-01-07 12:25
- Has thanked: 5 times
- Been thanked: 16 times
Re: [Solved] Making Any Command persistent across reboots?
I would change to root user and type crontab -e in terminal and then add something like this
although there are ways to run a command as another user from within the users crontab but I am not sure how privilege escalation works that way so cannot say it that would work.
This will not give your 1 minute delay although that could be achieved easily if you use a script instead of the direct command in the crontab entry and then simply start the script with a sleep 60 command if you really want/need that.
Code: Select all
@reboot /sbin/modprobe snd-aloop
This will not give your 1 minute delay although that could be achieved easily if you use a script instead of the direct command in the crontab entry and then simply start the script with a sleep 60 command if you really want/need that.
-
- Posts: 485
- Joined: 2009-07-04 06:32
- Location: Home: Barrackpore and Mysore
- Has thanked: 5 times
[Solved] Making Any Command persistent across reboots?
Thanks Dai for trying.
What would be the crontab code for running the scheduled job one minute after the runlevel5? Or after runlevel5 is reached?
Yes, with script it will be easy to run the script with crontab. But again, the runlevel5 has to be assured to automate the process entirely.
Otherwise, the old lxterminal with the ↑ keystroke in the lxterminal. three steps (one mouse click and two keystrokes) at worst.
Thanks once again, Dai.
What would be the crontab code for running the scheduled job one minute after the runlevel5? Or after runlevel5 is reached?
Yes, with script it will be easy to run the script with crontab. But again, the runlevel5 has to be assured to automate the process entirely.
Otherwise, the old lxterminal with the ↑ keystroke in the lxterminal. three steps (one mouse click and two keystrokes) at worst.
Thanks once again, Dai.
Last edited by bkpsusmitaa on 2018-09-11 11:30, edited 1 time in total.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
-
- Posts: 1100
- Joined: 2016-01-07 12:25
- Has thanked: 5 times
- Been thanked: 16 times
Re: [Solved] Making Any Command persistent across reboots?
The cron command does not execute until the desktop has initiated, I use it for my conky and it needs the desktop loaded before it can run so it should work without issue, you might be able to chain the sleep command using "&&" but I am not sure if cron would handle that correctly. I usually use a script if more than one command is required and have not tried to chain commands together in this way.man cron wrote:DESCRIPTION
cron is started automatically from /etc/init.d on entering multi-user runlevels.
-
- Posts: 485
- Joined: 2009-07-04 06:32
- Location: Home: Barrackpore and Mysore
- Has thanked: 5 times
Thanks, Dai and sunrat ...
Thanks, Dai. I should have looked at the manual for crontab.
But I had not yet planned for crontab. I was weighing the option for lxterminal with ↑ keystroke and enter.
However, that comment doesn't belittle your intent to help. or your actual help. Thanks once again, Dai and sunrat.
I hope this thread has served its purpose. So let us close our discussion.
But I had not yet planned for crontab. I was weighing the option for lxterminal with ↑ keystroke and enter.
However, that comment doesn't belittle your intent to help. or your actual help. Thanks once again, Dai and sunrat.
I hope this thread has served its purpose. So let us close our discussion.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home