LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-13-2010, 07:54 PM   #1
2handband
Member
 
Registered: Jan 2009
Location: Alexandria, Minnesota
Distribution: Manjaro
Posts: 837

Rep: Reputation: 96
Cron job not working


I set up a job in my crontab file to clear the /tmp file on bootup with the following line:

Code:
@reboot rm-rf /tmp/*
My /tmp folder is not clearing. I've never used cron before; can somebody tell me how to troubleshoot this?
 
Old 11-13-2010, 08:04 PM   #2
udaman
Member
 
Registered: Oct 2010
Location: New England, USA
Distribution: OpenSUSE/Slackware64/RHEL/Mythbuntu
Posts: 189

Rep: Reputation: 39
Quote:
Originally Posted by 2handband View Post
I set up a job in my crontab file to clear the /tmp file on bootup with the following line:

Code:
@reboot rm-rf /tmp/*
My /tmp folder is not clearing. I've never used cron before; can somebody tell me how to troubleshoot this?
It looks like you're missing a space in the command. It should be
Code:
rm -rf /tmp/*
 
Old 11-13-2010, 08:11 PM   #3
2handband
Member
 
Registered: Jan 2009
Location: Alexandria, Minnesota
Distribution: Manjaro
Posts: 837

Original Poster
Rep: Reputation: 96
Oh dear god... I can't believe I missed that. Thanks.
 
Old 11-14-2010, 07:19 AM   #4
2handband
Member
 
Registered: Jan 2009
Location: Alexandria, Minnesota
Distribution: Manjaro
Posts: 837

Original Poster
Rep: Reputation: 96
Okay, I thought it was solved, but it wasn't. I fixed the command error, but then when I rebooted /tmp didn't clear.
 
Old 11-14-2010, 07:24 AM   #5
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
Originally Posted by 2handband View Post
Okay, I thought it was solved, but it wasn't. I fixed the command error, but then when I rebooted /tmp didn't clear.
try to use the whole path to the command
When the system boots, tmp will be populated again.
Are you sure it isn't cleared?
Try to create a unique file in tmp, and see if that file is removed.


Kind regards

Last edited by repo; 11-14-2010 at 07:29 AM.
 
Old 11-14-2010, 07:29 AM   #6
diwljina
Member
 
Registered: Jun 2009
Distribution: Slackware, Debian
Posts: 111

Rep: Reputation: 8
Cron expects new line character at the end of every entry. Check if you have one. If you don't it will silently fail, without any error massage.
 
Old 11-14-2010, 09:22 AM   #7
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
Instead of use cron put in your /etc/rc.d/rc.local_shutdown file the line:

Code:
/usr/bin/find /tmp -mindepth 1 -maxdepth 1 -print0 | xargs -0r /bin/rm -fr
and make sure /etc/rc.d/rc.local_shutdown file is executable.

The file /etc/rc.d/rc.local_shutdown is executed during shutdown procedures while the file /etc/rc.d/rc.local is executed during bootup procedures.
 
Old 11-14-2010, 09:29 AM   #8
2handband
Member
 
Registered: Jan 2009
Location: Alexandria, Minnesota
Distribution: Manjaro
Posts: 837

Original Poster
Rep: Reputation: 96
Quote:
Originally Posted by diwljina View Post
Cron expects new line character at the end of every entry. Check if you have one. If you don't it will silently fail, without any error massage.
This solved it. thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Job in /etc/cron.d not working BrianK Linux - General 6 11-03-2011 09:03 AM
cron job not working bittus Linux - Software 7 04-27-2009 07:39 PM
cron job is not working moagalbm Linux - Newbie 7 02-29-2008 05:16 PM
Cron Job Not Working... ALInux Linux - Software 2 07-24-2007 04:15 AM
Cron job not quite working... simba_cubs Linux - General 10 11-08-2006 06:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration