LinuxQuestions.org
Review your favorite Linux distribution.
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 08-16-2005, 04:11 AM   #16
malo_umoran
Member
 
Registered: Dec 2003
Distribution: Desktop: Slackware 13.1 &13.37 | Server: Debian 6.0
Posts: 270

Rep: Reputation: 32

no, it would not survive reboot or crond restart.

there is no way you can do it just with crontab. you can use "at" or you can write a few lines in a shell script which will check everything.

M.
 
Old 08-16-2005, 06:07 PM   #17
rgiggs
Member
 
Registered: Apr 2004
Location: berkeley, ca
Distribution: slk10, winxp
Posts: 313

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by malo_umoran
you can write a few lines in a shell script which will check everything.
yea i will do that, and i now want to run the first saturday of each month:

if [ `date +%d` -gt 7 ] || [ `date +%u` -ne 6 ]; then
exit
fi

thanks all for answering.
 
Old 09-25-2005, 10:20 AM   #18
IanDMac
LQ Newbie
 
Registered: Sep 2005
Location: UK
Posts: 7

Rep: Reputation: 0
Hi,

Have been searching for an age along the same lines of running certain actions based on number of weeks, as opposed to date of month etc, so this is ideal, but my knowledge of nested else ifs and all that is not that good - Yes, thick springs to mind LOL anyway, the code provided below....

Quote:
Originally posted by Matir
Code:
#!/bin/bash
BASE="/tmp/every_3_weeks"
if [ -f "${BASE}.1" ]
    then if [ -f "${BASE}.2" ]
        then rm ${BASE}.?
        YOUR_COMMMAND_HERE
    else touch ${BASE}.2
    fi
else touch ${BASE}.1
fi
......... is great, but could someone direct me on adopting this and amending for a 4 week rotation, so the YOUR_COMMMAND_HERE is only run on the 4th week.

I know this is probably very easy, but 'yes' I am a and working hard at picking up all of the differences in doing this under a non win environment, so any help or advice would be very much appreciated and gratefull for any time anyone can spare to advise me...

Cheers, Mac
 
Old 09-25-2005, 04:56 PM   #19
major.tom
Member
 
Registered: Jun 2003
Location: Canada
Distribution: Slackware (current); Gentoo (newbie)
Posts: 142

Rep: Reputation: 15
Quote:
Originally posted by IanDMac
could someone direct me on adopting this and amending for a 4 week rotation, so the YOUR_COMMMAND_HERE is only run on the 4th week
That's simple enough. Just keep in mind that each .n (.1, .2) file is simply a tag to remember that n saturdays have gone by. So the new code would simply need a 3rd file to increase the executation time by 1 iteration:

Code:
#!/bin/bash
BASE="/tmp/every_4_weeks"
if [ -f "${BASE}.1" ]
    then if [ -f "${BASE}.2" ]
        then if [ -f "${BASE}.3" ]
            then rm ${BASE}.?
            YOUR_COMMMAND_HERE
        else touch ${BASE}.3
        fi
    else touch ${BASE}.2
    fi
else touch ${BASE}.1
fi

Last edited by major.tom; 09-25-2005 at 05:23 PM.
 
Old 09-26-2005, 05:59 PM   #20
IanDMac
LQ Newbie
 
Registered: Sep 2005
Location: UK
Posts: 7

Rep: Reputation: 0
Thanks a lot for that.

With that 3rd one inplace, I can see how it works now and how the nesting follows through, so can make more use of that I think, so thanks again, very much appreciated.

I have a lot more work to do before my self desired project is done and dusted, which is a multi versioned backup solution, with 7 days worth of full backups, with a further 4 end of week backup sets retained, then a further 3 end of month back up sets, which is coming along quite nicely.

I know this might seem like a bit of overkill on the backup side of things, but if I can get it to all tick over nicely, then a smaller one of a lesser nature will be a doddle - I hopes

Time to pick up on some error handling routines now - thanks again.

Mac
 
  


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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 09:09 AM
cron.allow and cron.deny in slackware? tl64 Slackware 5 10-13-2005 10:44 PM
On the lighter side of Saturday morning... JordanH General 5 05-01-2005 01:11 AM
[cron][mdk9.1]cron deamon seems to ignore some task... yannrichet Linux - Newbie 5 06-26-2003 10:57 AM
dual entries in cron log for cron.daily cpharvey Linux - General 3 02-27-2003 03:30 PM

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

All times are GMT -5. The time now is 07: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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration