crontab conf/base/etc/crontab help needed

Paul5

Contributor
Joined
Jun 17, 2013
Messages
117
I have a script that ran on 9.3 for years in the crontab but on 11.3 it won't run at startup. The command still works as tested in the shell with: env -i SHELL=/bin/sh PATH=" using cut and past so no typo's. It still works but the "conf/base/etc/crontab" doesn't seem to load it.

To modify the crontab I used:

1 - # mount -o rw /dev/ufs/FreeNASs1a /

2 - # nano /conf/base/etc/crontab

Then in nano entered the path:

3- @Reboot root PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /mnt/USB3/lable.sh > /dev/null

4- Then Ctrl O and Ctrl X to write out and exit.

Crontab at /conf/base/etc/crontab reflects the change:
#
*/5 * * * * root /usr/libexec/atrun
#
@Reboot root PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /mnt/USB3/lable.sh > /dev/null
# Save some entropy so that /dev/random can re-seed on boot.
*/11 * * * * operator /usr/libexec/save-entropy
#

I think from memory it's also supposed to reflect in "/etc/crontab" but it's not. If I'm right and it's supposed to reflect how do I do it for I don't remember doing anything else all those years ago.

Help!

For the curious. Unless things have changed it has to be done this way for the script is needed at startup and needs to keep running until it shuts itself down so standard cron or init won't work,
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Simply don't do that. You can setup cron jobs as well as startup or shutdown tasks in the "Task" menu of the UI.
 

Paul5

Contributor
Joined
Jun 17, 2013
Messages
117
Simply don't do that. You can setup cron jobs as well as startup or shutdown tasks in the "Task" menu of the UI.

How?
cron jobs are timed I cannot see a setting for startup.
Post Init requires a timeout integer in seconds so it can shutdown the script.

My script needs to start at startup and keep running until it shuts itself down on an IP detection which also then starts another script.

I'm happy to be wrong if you can show me.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Write a startup shellscript that puts a subshell in the background. I posted a script to do bridge and interface "magic" on startup.

The part between the opening and closing parentheses is put in the background.
 

Paul5

Contributor
Joined
Jun 17, 2013
Messages
117
Yeah, you lost me, from a simple line in crontab to > "Simply don't do that. You can setup cron jobs as well as startup or shutdown tasks in the "Task" menu of the UI." to Write a startup shellscript that puts a subshell in the background. I posted a script to do bridge and interface "magic" on startup.

So yeah you lost me. I've been at this upgrade resolving issues for over 18 hours and don't want more. But! you gave me an idea, simple script in 'Post Init' that will kick of my script. My script just needs to be started seems simple so I'll see how that works first. Fingers crossed.

You don't by any chance know anything about SMB shares, I have another issue: https://www.ixsystems.com/community...are-9-3-upgrade-to-11-3-u1.83040/#post-574433
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
I meant to link an example script I used as a post-init task. It kicks off $STUFF in the background then exits, while $STUFF keeps running. That is the part between "(" and ") &"

HTH,
Patrick
 

Paul5

Contributor
Joined
Jun 17, 2013
Messages
117
I'll have a play later. To tired to care right now and to many other issues.
 

Paul5

Contributor
Joined
Jun 17, 2013
Messages
117
I meant to link an example script I used as a post-init task. It kicks off $STUFF in the background then exits, while $STUFF keeps running. That is the part between "(" and ") &"

HTH,
Patrick

Thanks that's one thing sorted. I remember now why I needed it in the /etc/crontab
 
Top