need some input on jail rc.d script

Status
Not open for further replies.

Jerizo

Dabbler
Joined
Oct 14, 2015
Messages
16
So as it stands currently I have to run the following shell line everytime the jail restarts, through web interface:
~/./script1.sh arg0 arg1
I would like to automate this.

Upon researching the subject I learned about rc.d scripts. I then proceeded to create the below scripts (2 versions of the same thing that I though might work, based on other scripts I have seen) and placed it in /usr/local/etc/rc.d/
Also added the following line to /etc/rc.conf
scr0_enable ="YES"
Code:
#!/bin/sh

# PROVIDE: script0
# REQUIRE: LOGIN
# KEYWORD: shutdown

. /etc/rc.subr

name=scr0                                                             
rcvar=scr0_enable

~/./script0.sh arg1 arg2
run_rc_command "$1"

Code:
#!/bin/sh

# PROVIDE: script0
# REQUIRE: LOGIN
# KEYWORD: shutdown

. /etc/rc.subr

name=scr0                                                                 
rcvar=scr0_enable
load_rc_config $name
command=/script0.sh
command_args="arg0 arg1"

run_rc_command "$1"


Unfortunately both versions did not work so I though it might be time to ask for input.
 

Jerizo

Dabbler
Joined
Oct 14, 2015
Messages
16
Unfortunately I was not able to figure it out yet, no. Please do let me me know, if you happen to find a solution to this.
 
D

dlavigne

Guest
Are you not able to schedule script0.sh in Cron Jobs? I'm assuming the jail only restarts when the system does?
 

Jerizo

Dabbler
Joined
Oct 14, 2015
Messages
16
I believe you have a point there.
Had thought about this before but scrapped that idea rather quickly because there are some instances where I have to manually restart the jail. That however is related to some other issues, so once I get rid of those, Cron Jobs should be able to take care of my needs.

Thanks for the suggestion, I had not reconsidered this after initially abandoning that idea. I will try and implement it this way.
 
Status
Not open for further replies.
Top