I want to set up a cron job to copy a file from one directory to another directory (which is a subdirectory)
Can I do this directly from the cron setup or do I need to write a shell script to handle? Also, do I need to include the full path to the files?
If I was in the directory where the file was located, I would normally just type
cp file1.txt /targetdirectory
But I don't think that is working with the cron job...
---------- Post added 06-01-2012 at 02:46 AM ---------- Previous post was 05-31-2012 at 07:24 PM ----------
Ok, I was able to do what I wanted by creating a simple shell script... in the cron job I used
/usr/bin/sh [full path to script] >> [full path to error log]
in the script I had
#!/bin/bash
cp [full path to file] [full path to desired location]
Can I do this directly from the cron setup or do I need to write a shell script to handle? Also, do I need to include the full path to the files?
If I was in the directory where the file was located, I would normally just type
cp file1.txt /targetdirectory
But I don't think that is working with the cron job...
---------- Post added 06-01-2012 at 02:46 AM ---------- Previous post was 05-31-2012 at 07:24 PM ----------
Ok, I was able to do what I wanted by creating a simple shell script... in the cron job I used
/usr/bin/sh [full path to script] >> [full path to error log]
in the script I had
#!/bin/bash
cp [full path to file] [full path to desired location]