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
Run bash file on startup
Run bash file on startup
Hello.
I put some file with .sh suffix in /etc/init.d folder.
how do i run this file on startup?
I put some file with .sh suffix in /etc/init.d folder.
how do i run this file on startup?
-
- Posts: 4
- Joined: 2018-04-16 11:20
Re: Run bash file on startup
I find the easiest way to run a script at startup is to add an entry into crontab.
Run:
Then add a line at the end:
@reboot /etc/init.d/yourscript.sh
Side note, depending on what this script does, I wouldn't put it in the init.d folder. This is typically used for scripts that start/stop or display the status of services running on your system. Generally speaking, I put scripts in /usr/bin.
Run:
Code: Select all
crontab -e
@reboot /etc/init.d/yourscript.sh
Side note, depending on what this script does, I wouldn't put it in the init.d folder. This is typically used for scripts that start/stop or display the status of services running on your system. Generally speaking, I put scripts in /usr/bin.
Re: Run bash file on startup
i cant use crontabtsmith3480 wrote:I find the easiest way to run a script at startup is to add an entry into crontab.
Run:Then add a line at the end:Code: Select all
crontab -e
@reboot /etc/init.d/yourscript.sh
Side note, depending on what this script does, I wouldn't put it in the init.d folder. This is typically used for scripts that start/stop or display the status of services running on your system. Generally speaking, I put scripts in /usr/bin.
-sh: crontab: command not found
-
- Posts: 4
- Joined: 2018-04-16 11:20
Re: Run bash file on startup
Does...
orgive any results?
If not, you might have to install cron
Code: Select all
which crontab
Code: Select all
ps -ef | grep cron
If not, you might have to install cron
Code: Select all
sudo apt-get install cron
Re: Run bash file on startup
i am running it on embedded software. is there any other way to run the bash without install anything new?tsmith3480 wrote:Does...orCode: Select all
which crontab
give any results?Code: Select all
ps -ef | grep cron
If not, you might have to install cronCode: Select all
sudo apt-get install cron
-
- Posts: 4
- Joined: 2018-04-16 11:20
Re: Run bash file on startup
it is not workingtsmith3480 wrote:Yes, you would have to follow this pattern:
https://debian-administration.org/artic ... ith_Debian
- None1975
- df -h | participant
- Posts: 1404
- Joined: 2015-11-29 18:23
- Location: Russia, Kaliningrad
- Has thanked: 46 times
- Been thanked: 68 times
Re: Run bash file on startup
Because this is a very old manual. Currently Debian uses systemd as init system. Please, check this and this. Good luck.ronp20 wrote:it is not working
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github
Debian Wiki | DontBreakDebian, My config files on github
Re: Run bash file on startup
Easiest is to put your command in /etc/rc.localronp20 wrote:Hello.
I put some file with .sh suffix in /etc/init.d folder.
how do i run this file on startup?
If you're using systemd, makesure you run "systemctl enable rc-local".
If your program is not critical for startup make sure rc.local ends with "exit 0"
Re: Run bash file on startup
ronp20 wrote:i am running it on embedded software. is there any other way to run the bash without install anything new?
both these statements require a lot of additional information.ronp20 wrote:it is not working
please provide it.
we can only see what you tell us.