<editorial> I’m really liking nas4free so far in that I doubt I could have set up the basics of ZFS so quickly without. All that time saved though is being burned by tasks that would be pretty routine in a normal server config. Let’s see if I can make a contribution </editorial>
Synopsis: So is issue #1 a bug and should I submit it? There is a 2nd issue but it was a layer 8 problem for your reading enjoyment.
First Cron:
The cron setup is pretty intuitive iff you know cron. Cron has always been subject to careful environment setup and I’ve usually handled that with scripts and/or absolute path names to executables. What is not intuitive (to me) is the behaviour of the “run now” GUI command and exactly what shell is running the script. As an example here is a simple touchme script:
Code: Select all
#!/usr/local/bin/bash
MYFILE=/tmp/mytouchmefile
rm $MYFILE
echo $SHELL > $MYFILE
# /usr/bin/touch $MYFILE
exitCode: Select all
[ijeff@nas4free ~/bin]$ ./touchme
[ijeff@nas4free ~/bin]$ ls -l /tmp/mytouchmefile ; cat /tmp/mytouchmefile
-rw-r--r-- 1 ijeff wheel 10 Dec 6 09:48 /tmp/mytouchmefile
/bin/bashCode: Select all
[ijeff@nas4free ~/bin]$ ls -l /tmp/mytouchmefile ; cat /tmp/mytouchmefile
-rw-r--r-- 1 ijeff wheel 8 Dec 6 09:49 /tmp/mytouchmefile
/bin/shCode: Select all
[ijeff@nas4free ~/bin]$ ls -l /tmp/mytouchmefile ; cat /tmp/mytouchmefile
-rw-r--r-- 1 root wheel 10 Dec 6 09:52 /tmp/mytouchmefile
/bin/tcshThere are two apparent problems.
#1 the file ownership is incorrect in the “run now” cron GUI case
#2 the shell is wrong in the cron case (it should be bash shouldn’t it?)
A bit more debugging and I realize that the second issue isn’t. I should have been looking a bit deeper into the SHELL variable which is the default shell. The new script is:
Code: Select all
#!/usr/local/bin/bash
MYFILE=/tmp/mytouchmefile
rm $MYFILE
ps -l >> $MYFILE
# /usr/bin/touch $MYFILE
exitCode: Select all
[ijeff@nas4free ~/bin]$ ls -l /tmp/mytouchmefile ; cat /tmp/mytouchmefile
-rw-r--r-- 1 ijeff wheel 223 Dec 6 10:43 /tmp/mytouchmefile
UID PID PPID CPU PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND
1001 11120 11119 0 20 0 17640 3556 ttyin Is+ 0 0:00.29 -bash (bash)
1001 11587 11586 0 20 0 17640 3532 wait Is 1 0:00.02 -bash (bash)
Code: Select all
[ijeff@nas4free ~/bin]$ ./touchme
[ijeff@nas4free ~/bin]$ ls -l /tmp/mytouchmefile ; cat /tmp/mytouchmefile
-rw-r--r-- 1 ijeff wheel 385 Dec 6 10:43 /tmp/mytouchmefile
UID PID PPID CPU PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND
1001 11120 11119 0 20 0 17640 3556 wait Ss 0 0:00.30 -bash (bash)
1001 12148 11120 0 23 0 17640 3256 wait S+ 0 0:00.01 /usr/local/bin/bash ./touchme
1001 12150 12148 0 23 0 18760 2372 - R+ 0 0:00.00 ps -l
1001 11587 11586 0 20 0 17640 3532 wait Is 1 0:00.02 -bash (bash)Code: Select all
<job>
<enable/>
<uuid>f8eab5f1-9f3d-427d-8329-60054e4ef462</uuid>
<desc>touchme</desc>
<minute/>
<hour/>
<day/>
<month/>
<weekday/>
<all_mins>1</all_mins>
<all_hours>1</all_hours>
<all_days>1</all_days>
<all_months>1</all_months>
<all_weekdays>1</all_weekdays>
<who>ijeff</who>
<command>/mnt/Pool1b/DS2Z/home/ijeff/bin/touchme</command>
</job>
