On Thu, 11 Apr 2019 at 08:18, Software Info <softwareinfojam at gmail.com>
wrote:>
> Hi All
> I am trying to schedule cron to run a script. The script is in my home
directory and so I added my home directory to the path file in /etc/crontab
below.
>
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin:/home:/home/me
>
> This is the crontab entry for the scheduled task below.
> 49 14 * * 1-5 root myscript.sh
>
> myscript.sh grabs a file from another directory if it is there. If not, it
says ?file not uploaded?. If the file is there, it copies it to my home
directory, strips email addresses out of it and uses mailx to send emai to those
users. I keep getting the error that a number of files in my home directory are
missing but they are not.
>
> Please see errors below
> mv: rename *.csv to listing.csv: No such file or directory
> grep: listing.csv: No such file or directory
> /home/me/ipo-script.sh: cannot open body.txt: No such file or directory
> mv: rename /home/me/listing.txt to /home/me/listing.txt-10-04-19-1435: No
such file or directory
> mv: rename /home/me/listing.csv to /home/me/listing.csv-10-04-19-1435: No
such file or directory
> mv: rename /home/me/listing.txt-10-04-19-1435 to
/home/me/IPO-Backup-Files/listing.txt-10-04-19-1435: No such file or directory
> mv: rename /home/me/listing.csv-10-04-19-1435 to
/home/me/IPO-Backup-Files/listing.csv-10-04-19-1435: No such file or directory
>
> Because I added my home directory to the path in crontab, I am at a loss to
explain why this is still happening. Anyone have any ideas? Would really
appreciate some help.
You are assuming that the script starts in your home directory. It
doesn't, hence: "mv: rename *.csv to listing.csv: No such file or
directory"
--
Jonathan Chen <jonc at chen.org.nz>