Author Topic: Joe <3 cron!  (Read 7595 times)

0 Members and 1 Guest are viewing this topic.

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Joe <3 cron!
« on: March 28, 2006, 07:45:26 am »
Yup. I'm not sure it if's just debian/ubuntu, or it's for all of Linux (I assume the latter), but it's a scheduling daemon. Right now, here's root's crontabs.

30 22 * * * echo "Starting dist-upgrade: $(date)" >> /tmp/update.log && /usr/bin/apt-get update -y && /usr/bin/apt-get dist-upgrade -y


From the Ubuntu Wiki Page about cron, it says that the first five spaces (here: "30 22 * * *") specify, in order, the *minute*, *hour*, *day of month*, *month* and *day of week*.

So I have these tasks scheduled to occur at 10:30 (2230 military time) each night:
Make a note about system upgrade in /tmp/update.log
Get list of latest updates (apt-get update -y)
Download + install them (apt-get dist-upgrade -y)
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: Joe <3 cron!
« Reply #1 on: March 28, 2006, 08:40:02 am »
That's ridiculous. That's gonna be such a bandwidth whore.

Good idea though, if you can afford the bandwidth/CPU speed you'll be eating 10:30 each night downloading and installing shit. :P
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: Joe <3 cron!
« Reply #2 on: March 28, 2006, 09:44:43 am »
If your distro gets minor updates every now and then, once a week is best.  Otherwise I'd personally set it to once a month or quarter.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: Joe <3 cron!
« Reply #3 on: March 28, 2006, 02:47:12 pm »
Any distro CAN run cron, and every distro that I'm familiar with does. 

On darkside, I have a nightly crontab to back up key databases and files. 

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Joe <3 cron!
« Reply #4 on: March 28, 2006, 05:15:38 pm »
That's ridiculous. That's gonna be such a bandwidth whore.

Good idea though, if you can afford the bandwidth/CPU speed you'll be eating 10:30 each night downloading and installing shit. :P

I can EASILY afford the CPU speed (2.8GHz runs Linux like nobody's business), and afford the bandwidth (nobody will be awake until 6:30 the next morning). And the only time I'll be downloading is if an update comes out. Apt-get update will check hit/miss on the repository lists, and if theres a miss THEN it downloads the list, and apt-get dist-upgrade will only download if everything isn't current.

If your distro gets minor updates every now and then, once a week is best.  Otherwise I'd personally set it to once a month or quarter.

It's pretty much configured for when I switch to dapper drake (development version), so I don't get piled up on. But yeah, this is a bit overkill.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: Joe <3 cron!
« Reply #5 on: March 28, 2006, 06:33:42 pm »
I should do something similar to this with FreeBSD && portupgrade.
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Joe <3 cron!
« Reply #6 on: March 28, 2006, 06:59:53 pm »
Btw, this idea is copywrite 2006 Joe. (kidding, but still.. royalty please).
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Joe <3 cron!
« Reply #7 on: March 29, 2006, 12:19:15 am »
On darkside, I have a nightly crontab to back up key databases and files. 

Hehe, I do the same on deepthought.  Crontabs are so more straightforward and flexible than Windows' "Scheduled Tasks."

Offline Ergot

  • 吴立峰 ^_^ !
  • x86
  • Hero Member
  • *****
  • Posts: 3724
  • I steal bandwidth. p_o
    • View Profile
Re: Joe <3 cron!
« Reply #8 on: March 29, 2006, 12:54:04 am »
I use cron to stop my computer from flying ahead 1 minute every week >:\
Who gives a damn? I fuck sheep all the time.
And yes, male both ends.  There are a couple lesbians that need a two-ended dildo...My router just refuses to wear a strap-on.
(05:55:03) JoE ThE oDD: omfg good job i got a boner thinkin bout them chinese bitches
(17:54:15) Sidoh: I love cosmetology

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Joe <3 cron!
« Reply #9 on: March 29, 2006, 09:59:59 am »
Why the hell would it do that? =p

EDIT -
My computer is sync'd with USAC on startup. Not that I need to restart very often.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Joe <3 cron!
« Reply #10 on: March 29, 2006, 10:49:13 am »
I use cron to stop my computer from flying ahead 1 minute every week >:\

I have a crontab to do that as well. :)

Why the hell would it do that? =p

EDIT -
My computer is sync'd with USAC on startup. Not that I need to restart very often.

* Sidoh shrugs.

His CPU is in relative motion, I'd say. ;)

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: Joe <3 cron!
« Reply #11 on: March 30, 2006, 12:13:12 am »
I use cron to stop my computer from flying ahead 1 minute every week >:\

Speaking of that, what's the command to update to a NTS server?  Darkside tends to lose time, so it would help to update it nightly. :)

Offline Ergot

  • 吴立峰 ^_^ !
  • x86
  • Hero Member
  • *****
  • Posts: 3724
  • I steal bandwidth. p_o
    • View Profile
Re: Joe <3 cron!
« Reply #12 on: March 30, 2006, 12:39:32 am »
# ntpdate pool.ntp.org
Who gives a damn? I fuck sheep all the time.
And yes, male both ends.  There are a couple lesbians that need a two-ended dildo...My router just refuses to wear a strap-on.
(05:55:03) JoE ThE oDD: omfg good job i got a boner thinkin bout them chinese bitches
(17:54:15) Sidoh: I love cosmetology

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Joe <3 cron!
« Reply #13 on: March 30, 2006, 07:49:35 am »
Hehe @ darkside being to slow to even keep track of time.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Joe <3 cron!
« Reply #14 on: March 30, 2006, 10:24:07 am »
Hehe @ darkside being to slow to even keep track of time.

It happens.  It's because his CPU is in relative motion.  Duh.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: Joe <3 cron!
« Reply #15 on: March 30, 2006, 01:11:07 pm »
Hehe @ darkside being to slow to even keep track of time.
The time isn't kept track of by the CPU, it's an independent component in the BIOS.  And it's a really old computer, so it's got a crappy BIOS. 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Joe <3 cron!
« Reply #16 on: March 30, 2006, 01:14:39 pm »
The time isn't kept track of by the CPU, it's an independent component in the BIOS.  And it's a really old computer, so it's got a crappy BIOS. 

Obviously, I was testing Joe.  I meant that your BIOS is in relative motion.

... >_>

I seriously kind of knew that (though I've never really worded it), since it's obvious that time is kept when the computer has no power.

Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: Joe <3 cron!
« Reply #17 on: March 30, 2006, 03:41:00 pm »
I always wondered why the forums time was always late 10-20 minutes every time I checked.   :)

I think auto-updating is a neat idea, for a server/testbox like BATSERVER which is currently Resting In Peices.
And like a fool I believed myself, and thought I was somebody else...

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: Joe <3 cron!
« Reply #18 on: March 30, 2006, 08:21:24 pm »
The time isn't kept track of by the CPU, it's an independent component in the BIOS.  And it's a really old computer, so it's got a crappy BIOS. 

Obviously, I was testing Joe.  I meant that your BIOS is in relative motion.

... >_>

I seriously kind of knew that (though I've never really worded it), since it's obvious that time is kept when the computer has no power.

I wasn't listening to you, but yeah, if the bios is moving then the whole computer is.  Maybe I should stop it from vibrating to fix the clock?

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: Joe <3 cron!
« Reply #19 on: March 30, 2006, 08:29:42 pm »
All right, darkside's time should be fixed nightly now. 

The script is super simple:

Code: [Select]
#!/bin/sh

DATE="/bin/date"
NTPDATE="/usr/sbin/ntpdate"
NTPSERVER="pool.ntp.org"

$DATE
$NTPDATE "$NTPSERVER"
$DATE

Notice that I like to store program names in variables.  Most people don't do that, but I find it helpful in case a program moves.