Need help setting up cron

Robert Dailey rcdailey at gmail.com
Thu Jul 17 20:10:00 UTC 2008


On Thu, Jul 17, 2008 at 2:00 PM, Schiz0 <schiz0phrenic21 at gmail.com> wrote:
> On Thu, Jul 17, 2008 at 2:47 PM, Robert Dailey <rcdailey at gmail.com> wrote:
>> On Tue, Jul 15, 2008 at 1:27 PM, Brie Gordon <brie.gordon at gmail.com> wrote:
>>>
>>> On Tue, Jul 15, 2008 at 2:20 PM, Nils Kassube <kassube at gmx.net> wrote:
>>>>
>>>> Robert Dailey wrote:
>>>> > I'm currently running Ubuntu Server 8.04, and I am having difficulty
>>>> > getting the cron program to work.
>>>> >
>>>> > First, I tried adding the following to /etc/crontab:
>>>> >
>>>> > 30 12 * * * root /my/script/file
>>>> >
>>>> > For testing, I put in an hour & minute that was about 2 minutes ahead
>>>> > of the current time so I could see if it worked. First of all, I was
>>>> > not able to find a log file *anywhere* to tell me if the task was run
>>>> > or not.
>>>>
>>>> In /var/log/syslog I can see entries from CRON. While I'm using the
>>>> desktop version, I don't think it should be different for the server
>>>> version. If you don't see any entries, is cron running?
>>>>
>>>> > Secondly, the script in question created a set of directories,
>>>> > so I checked to see if those directories were created in order to
>>>> > verify if the script was run. However, I did not find the directories,
>>>> > which leads me to believe the script was not executed.
>>>>
>>>> Usually I forget to make scripts executable. Can you run the script
>>>> manually?
>>>>
>>>> > I did a little more research on google and I tried doing "crontab -e"
>>>> > and putting the entry there, however it still did not work.
>>>>
>>>> Don't forget: With "crontab -e" you create a crontab for the individual
>>>> user who invoked the command. Therefore you should leave away the "root"
>>>> portion of the entry to make it work.
>>>>
>>>>
>>>> Nils
>>>>
>>>> --
>>>> ubuntu-users mailing list
>>>> ubuntu-users at lists.ubuntu.com
>>>> Modify settings or unsubscribe at:
>>>> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>>>
>>> Try reading through this for a good background and understanding of crontab:
>>> https://help.ubuntu.com/community/CronHowto
>>>
>>>
>>> Regards,
>>>
>>> Brie Gordon
>>>
>>> http://granite.sru.edu/~bag6849/index.html
>>
>> Yes, I can run the script manually.
>>
>> I did the following:
>>
>> 1) Log in as root
>> 2) "crontab -e"
>> 3) Add my task
>>
>> When the time comes for it to be executed, I do not see the folders
>> generated that the script should be making. I go to /var/log/syslog
>> and I see:
>>
>> Jul 17 13:35:01 server /USR/SBIN/CRON[8221]: (root) CMD
>> (/svn_root/backup.script)
>>
>> /svn_root/backup.script is the script that I set the task to execute
>> and at the exact time that the log is showing (13:35). Why don't I see
>> the folders created that the script made?
>>
>> Something is wrong...
>>
>
> Are you using full paths? Cron generally doesn't have $PATH set, so
> it's a good habit and practice to use full paths. In the script,
> instead of running "mkdir test" to create /svn_root/test, run "mkdir
> /svn_root/test" instead.

Hi,

I found out that my script was broken. After fixing it, however, I
noticed that my directories were being created, but it didn't seem to
be doing anything else. Note that this script is performing a backup
and then compressing files. This process can take up to 30 minutes or
maybe more. The first thing the script is supposed to do is create a
subversion repository dump file which is about 600MB in size. 20
minutes after the script was executed, I noticed my dump file was
created but it was 0 bytes in size. It's almost as if the script was
prematurely interrupted and wasn't given enough time to finish.

Is there a reason for this? Thanks for helping out guys.




More information about the ubuntu-users mailing list