0

I am trying to schedule a perl script to run daily, but I am not sure if I am doing everything right.

The script I want to run is to update AWStats each day, without manually having to press update.

Currently, I created a file in the cron.d folder with the following text inside:

00 09 * * * /usr/local/awstats/cgi-bin/awstats.pl -config=cwp-dev-02

If I run:

/usr/local/awstats/cgi-bin/awstats.pl -config=cwp-dev-02

The stats update succesfully, but nothing seems to happen with the scheduled task...

boburob
  • 1,174
  • 8
  • 23

2 Answers2

1

I think you need to include a username in the job spec e.g.

00 09 * * * root /usr/local/awstats/cgi-bin/awstats.pl -config=cwp-dev-02

because the files in /etc/cron.d are treated in the same way as the /etc/crontab file. Also check that only root can write to the file.

user9517
  • 115,471
  • 20
  • 215
  • 297
1

Don't copy such files directly into cron.d - instead use the crontab(1) command to inject new commands.

Suppose your entries are in a file named mycrontab:

 $ crontab mycrontab

and you're done

ktf
  • 194
  • 3