How to run simple command on startup on FreeBSD?
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I need to run a very simple command at startup on my machine using FreeBSD:
cd /home/portal
mv portal.sqlite corrupt_portal.sqlite
This is clearly not a daemon or a service, just a one time command at every boot.
I tried to put a .sh file inside /usr/local/etc/rc.d/ with #!/bin/bash
and it doesn't do anything, I also tried to simply write touch testfile
If I run both versions manually they work with no problem.
What am I missing here?
freebsd startup
migrated from serverfault.com Sep 11 at 7:48
This question came from our site for system and network administrators.
add a comment |Â
up vote
3
down vote
favorite
I need to run a very simple command at startup on my machine using FreeBSD:
cd /home/portal
mv portal.sqlite corrupt_portal.sqlite
This is clearly not a daemon or a service, just a one time command at every boot.
I tried to put a .sh file inside /usr/local/etc/rc.d/ with #!/bin/bash
and it doesn't do anything, I also tried to simply write touch testfile
If I run both versions manually they work with no problem.
What am I missing here?
freebsd startup
migrated from serverfault.com Sep 11 at 7:48
This question came from our site for system and network administrators.
I'm not sure you're missing anything, freebsd.org/doc/en_US.ISO8859-1/articles/linux-users/⦠- You can see the order using rcorder: forums.freebsd.org/threads/⦠.
â Rob
Sep 11 at 8:47
Related: stackoverflow.com/a/52036993/4694621
â Mateusz Piotrowski
Sep 11 at 19:11
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I need to run a very simple command at startup on my machine using FreeBSD:
cd /home/portal
mv portal.sqlite corrupt_portal.sqlite
This is clearly not a daemon or a service, just a one time command at every boot.
I tried to put a .sh file inside /usr/local/etc/rc.d/ with #!/bin/bash
and it doesn't do anything, I also tried to simply write touch testfile
If I run both versions manually they work with no problem.
What am I missing here?
freebsd startup
I need to run a very simple command at startup on my machine using FreeBSD:
cd /home/portal
mv portal.sqlite corrupt_portal.sqlite
This is clearly not a daemon or a service, just a one time command at every boot.
I tried to put a .sh file inside /usr/local/etc/rc.d/ with #!/bin/bash
and it doesn't do anything, I also tried to simply write touch testfile
If I run both versions manually they work with no problem.
What am I missing here?
freebsd startup
freebsd startup
edited Sep 16 at 12:17
Jeff Schaller
33.1k849111
33.1k849111
asked Sep 11 at 7:42
Sandro Antonucci
1161
1161
migrated from serverfault.com Sep 11 at 7:48
This question came from our site for system and network administrators.
migrated from serverfault.com Sep 11 at 7:48
This question came from our site for system and network administrators.
I'm not sure you're missing anything, freebsd.org/doc/en_US.ISO8859-1/articles/linux-users/⦠- You can see the order using rcorder: forums.freebsd.org/threads/⦠.
â Rob
Sep 11 at 8:47
Related: stackoverflow.com/a/52036993/4694621
â Mateusz Piotrowski
Sep 11 at 19:11
add a comment |Â
I'm not sure you're missing anything, freebsd.org/doc/en_US.ISO8859-1/articles/linux-users/⦠- You can see the order using rcorder: forums.freebsd.org/threads/⦠.
â Rob
Sep 11 at 8:47
Related: stackoverflow.com/a/52036993/4694621
â Mateusz Piotrowski
Sep 11 at 19:11
I'm not sure you're missing anything, freebsd.org/doc/en_US.ISO8859-1/articles/linux-users/⦠- You can see the order using rcorder: forums.freebsd.org/threads/⦠.
â Rob
Sep 11 at 8:47
I'm not sure you're missing anything, freebsd.org/doc/en_US.ISO8859-1/articles/linux-users/⦠- You can see the order using rcorder: forums.freebsd.org/threads/⦠.
â Rob
Sep 11 at 8:47
Related: stackoverflow.com/a/52036993/4694621
â Mateusz Piotrowski
Sep 11 at 19:11
Related: stackoverflow.com/a/52036993/4694621
â Mateusz Piotrowski
Sep 11 at 19:11
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
The rc(8) script is responsible for running the automatic boot process, and the example section of the manual gives a simple template for the /etc/rc.d/
directory. Read the rc.subr(8) manual page for further guidance on writing startup scripts.
However, one of the final stages of the automatic boot process is to read a script file called /etc/rc.local
(if it exists). This file requires no special formatting or keywords, or the execute bit set.
From the rc(8)
manual page:
Typically, the /usr/local/etc/rc.d/ mechanism is used instead of rc.local these days but if you want to use rc.local, it is still supported.
add a comment |Â
up vote
1
down vote
The easiest way is to put that command to the crontab
.
Instead of first five fields usually filled as asterisks you can place the special token @reboot
@reboot root:wheel /path/to/the/command [args ...]
This command will be launched each time the system been rebooted.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
The rc(8) script is responsible for running the automatic boot process, and the example section of the manual gives a simple template for the /etc/rc.d/
directory. Read the rc.subr(8) manual page for further guidance on writing startup scripts.
However, one of the final stages of the automatic boot process is to read a script file called /etc/rc.local
(if it exists). This file requires no special formatting or keywords, or the execute bit set.
From the rc(8)
manual page:
Typically, the /usr/local/etc/rc.d/ mechanism is used instead of rc.local these days but if you want to use rc.local, it is still supported.
add a comment |Â
up vote
3
down vote
The rc(8) script is responsible for running the automatic boot process, and the example section of the manual gives a simple template for the /etc/rc.d/
directory. Read the rc.subr(8) manual page for further guidance on writing startup scripts.
However, one of the final stages of the automatic boot process is to read a script file called /etc/rc.local
(if it exists). This file requires no special formatting or keywords, or the execute bit set.
From the rc(8)
manual page:
Typically, the /usr/local/etc/rc.d/ mechanism is used instead of rc.local these days but if you want to use rc.local, it is still supported.
add a comment |Â
up vote
3
down vote
up vote
3
down vote
The rc(8) script is responsible for running the automatic boot process, and the example section of the manual gives a simple template for the /etc/rc.d/
directory. Read the rc.subr(8) manual page for further guidance on writing startup scripts.
However, one of the final stages of the automatic boot process is to read a script file called /etc/rc.local
(if it exists). This file requires no special formatting or keywords, or the execute bit set.
From the rc(8)
manual page:
Typically, the /usr/local/etc/rc.d/ mechanism is used instead of rc.local these days but if you want to use rc.local, it is still supported.
The rc(8) script is responsible for running the automatic boot process, and the example section of the manual gives a simple template for the /etc/rc.d/
directory. Read the rc.subr(8) manual page for further guidance on writing startup scripts.
However, one of the final stages of the automatic boot process is to read a script file called /etc/rc.local
(if it exists). This file requires no special formatting or keywords, or the execute bit set.
From the rc(8)
manual page:
Typically, the /usr/local/etc/rc.d/ mechanism is used instead of rc.local these days but if you want to use rc.local, it is still supported.
answered Sep 11 at 8:35
Richard Smith
801148
801148
add a comment |Â
add a comment |Â
up vote
1
down vote
The easiest way is to put that command to the crontab
.
Instead of first five fields usually filled as asterisks you can place the special token @reboot
@reboot root:wheel /path/to/the/command [args ...]
This command will be launched each time the system been rebooted.
add a comment |Â
up vote
1
down vote
The easiest way is to put that command to the crontab
.
Instead of first five fields usually filled as asterisks you can place the special token @reboot
@reboot root:wheel /path/to/the/command [args ...]
This command will be launched each time the system been rebooted.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
The easiest way is to put that command to the crontab
.
Instead of first five fields usually filled as asterisks you can place the special token @reboot
@reboot root:wheel /path/to/the/command [args ...]
This command will be launched each time the system been rebooted.
The easiest way is to put that command to the crontab
.
Instead of first five fields usually filled as asterisks you can place the special token @reboot
@reboot root:wheel /path/to/the/command [args ...]
This command will be launched each time the system been rebooted.
answered Sep 11 at 9:06
Kondybas
49827
49827
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f468196%2fhow-to-run-simple-command-on-startup-on-freebsd%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
I'm not sure you're missing anything, freebsd.org/doc/en_US.ISO8859-1/articles/linux-users/⦠- You can see the order using rcorder: forums.freebsd.org/threads/⦠.
â Rob
Sep 11 at 8:47
Related: stackoverflow.com/a/52036993/4694621
â Mateusz Piotrowski
Sep 11 at 19:11