Cron job to clear sessions

  • mo_mughrabi
  • Student
  • Student
  • User avatar
  • Posts: 73

Post 3+ Months Ago

Hello,

Am not familiar with crontab at all. I was just hoping if someone can help me with to setup a cron to run every Friday and if possible to point a specific file to run on time..

thanks
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • AnarchY SI
  • Web Master
  • Web Master
  • User avatar
  • Posts: 2521
  • Loc: /usr/src/MI

Post 3+ Months Ago

lol dude, you really need to discover google.. :P
I searched it for: crontab
this is the first link that came up, Unix Crontab - setting up cron jobs using crontab
  • mo_mughrabi
  • Student
  • Student
  • User avatar
  • Posts: 73

Post 3+ Months Ago

yeah, i was actually using this command

[root@systems]# crontab -e * * * * 6 rm /var/www/html/demo2/doc_root/i/captcha/*.png
crontab: usage error: no arguments permitted after this option

am not sure what is the right arguments used in there? thanks for the link you gave me was really nice manual but still couldn't come across a full written example to help me.
  • AnarchY SI
  • Web Master
  • Web Master
  • User avatar
  • Posts: 2521
  • Loc: /usr/src/MI

Post 3+ Months Ago

edit the file /etc/crontab and add your command there.
the command you would add would be..
Quote:
* * * * 6 rm /var/www/html/demo2/doc_root/i/captcha/*.png
  • harrysmith
  • Graduate
  • Graduate
  • harrysmith
  • Posts: 136
  • Loc: Leeds

Post 3+ Months Ago

mo_mughrabi wrote:
[root@systems]# crontab -e * * * * 6 rm /var/www/html/demo2/doc_root/i/captcha/*.png
.


IMO you should use
Quote:
[root@systems]Crontab –e
* * * * 6 /bin/rm -f /var/www/html/demo2/doc_root/i/captcha/*.png

Hope this will help you.
  • mo_mughrabi
  • Student
  • Student
  • User avatar
  • Posts: 73

Post 3+ Months Ago

harrysmith wrote:
mo_mughrabi wrote:
[root@systems]# crontab -e * * * * 6 rm /var/www/html/demo2/doc_root/i/captcha/*.png
.


IMO you should use
Quote:
[root@systems]Crontab –e
* * * * 6 /bin/rm -f /var/www/html/demo2/doc_root/i/captcha/*.png

Hope this will help you.


IT'S WORKING!! THANKS!
  • Abdussamad
  • Newbie
  • Newbie
  • User avatar
  • Posts: 9
  • Loc: Pakistan

Post 3+ Months Ago

You may want to use 5 instead of 6 if you want your cronjob to run on friday. Also I think you need to specify a time or it will run every minute of every hour of ever friday.

00 00 * * 5 /bin/rm -f /var/www/html/demo2/doc_root/i/captcha/*.png > /dev/null

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 88 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.