Where to put scripts ?

Alex Zbyslaw xfb52 at dial.pipex.com
Tue Jul 26 11:00:52 GMT 2005


Norbert Koch wrote:

>>I have a short script for Flexbackup ;
>>
>>#!/bin/sh
>># Backup using Flexbackup
>>/bin/rm -f /data/IT/Backup_Log/data*
>>/usr/local/bin/flexbackup -newtape
>>/usr/local/bin/flexbackup -dir /data
>>/usr/bin/mt -f /dev/sa0 rewind
>>/usr/bin/mt -f /dev/sa0 offline
>>
>>I put this in /usr/bin/ and made exec
>>
>>In crontab I put ;
>>
>># Flexbackup Nightly Backup Job
>>0 	2 	* 	* 	1-5 	root 	/usr/bin/backup
>>
>>If I run the script manually at the prompt
>>it works perfectly and a new log is written
>>to /data/IT/Backup_Log/ - Great !
>>
>>(From flexbackup.conf
>>
>>$logdir = '/data/IT/Backup_Log';   # directory for log files)
>>
>>If cron runs it, the old log is rm'ed but no new one is written ???
>>
>>Is it something to do with paths / perms ?
>>    
>>
>
>Look into crontab(5). There is a section about the environment settings.
>My idea is that flexbackup calls some program w/o full path.
>Is flexbackup a shell/perl/* script?
>  
>
I would also ask, why are you putting it in /usr/bin?  Given that your 
script calls things in /usr/local/bin already, there is no advantage I 
can see to polluting /usr/bin.

To test Norbert's hypothesis, take everything except standard 
directories out of your path and then try running your script.

Does the user owning the cronjob receive any mail with suggestive errors?

--Alex



More information about the freebsd-questions mailing list