You are not logged in.

#1 2009-09-03 03:21:19

umpalumpa1985
Member
From: America
Registered: 2007-12-05
Posts: 134

automatic upgrade/shutdown

ok so i don't know much about cron jobs, but i would like to set one up for a friend of mine who is terrible about performing updates to automatically do a global update/upgrade and shut off the computer at, say, 2300 every night.  thanks for any help.


Never interrupt your enemy when he's making a mistake.    ~Napoleon Bonaparte

Offline

#2 2009-09-03 04:35:18

neddie_seagoon
Member
Registered: 2009-08-23
Posts: 121

Re: automatic upgrade/shutdown

You would need to have a crontab entry ('crontab -e' as root) look like this:
00 23 * * * /usr/bin/pacman -Syyu --noconfirm && shutdown -h now

That being said, I'm not sure if an unattended system upgrade is such a good idea in case there are pacnew files that should be merged, etc.

Offline

#3 2009-09-03 04:53:31

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: automatic upgrade/shutdown

This idea is so bad that you could probably get a job at the USPTO by simply sending them a link to this thread.

Do not do this. It is almost guaranteed to break the system, especially if you shut down the system afterwards. Also, wouldn't that just piss off your friend if he's on the computer at whatever time you set it to upgrade and shutdown?

I get the feeling that you talked a non-computer-literate friend into installing Arch and that he would have been happier with something less involved such as Ubuntu. Arch isn't for everybody and you should consider helping your friend set up something else if he can't handle maintaining his own system. If you really want to help him keep it up-to-date, get him to set up an ssh account for you so you can do remote maintenance. Just be careful that you don't expose him to a plethora of security risks by doing so.

Of course, the best would be to sit down with him and teach him how maintain it himself, if he's so inclined.

Last edited by Xyne (2009-09-03 04:55:08)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#4 2009-09-03 08:00:41

umpalumpa1985
Member
From: America
Registered: 2007-12-05
Posts: 134

Re: automatic upgrade/shutdown

First off, when he came to me and asked me to install a linux distro on his computer, the first thing i did was install Ubuntu.  Because he is, in fact, very computer illiterate.  And the first thing he did was to promptly tell me how he was tired of it taking so long to boot, et cetera.  I actually tried to convince him not to install Arch, but he was impressed with my setup at home, so he insisted.  So i installed Arch.  And he enjoys it very much.  I spent about a month taking him through the ins and outs of things;  everything from basic maintenance and administration of any unix-like system, to things specific to Arch linux, like the package manager and the configuration files.  I even tried to make it easy for him to update by teaching him how to make an alias in his .bashrc.  And then I told him to make sure that he comes home from work that day and updates his computer.  I set up pacman to ignore any upgrades that would prevent his computer from booting on any day to the desktop he is so familiar with by now, like his video card driver, X server, etc.  The way i see it, as long as his base system is up to date, he shouldn't have too many problems.  And, foreseeing what was about to happen, i set up ssh access for only my username from only my ip so that if he broke something I would be able to fix it without driving 20 minutes to the base.  In short, I have tried everything that you recommended for me to do. including trying to convince him *not* to install Arch.

But to answer your first question, no, he would not be pissed off about the computer upgrading and shutting down at 11 every night, because he's always in the rack by then, and he always shuts off his computer when he hits the rack for the night.

So thank you for the help.  I now know how to do this, and I also know that it is apparently a horrible idea.  And i will relay that information to him.  If he insists that i do it anyway, like he usually does even after me educating him on something and advising against it, then I will.  It is his computer, after all.  If he agrees not to, then I'll continue logging in every now and then and upgrading his software, telling him to keep on top of his own updates, and generally wasting my breath.


Never interrupt your enemy when he's making a mistake.    ~Napoleon Bonaparte

Offline

#5 2009-09-03 17:12:36

Sophotect
Member
From: Hyperbolic excess
Registered: 2007-03-25
Posts: 30

Re: automatic upgrade/shutdown

Maybe this would be more appropriate for someone who is "computerilleterate" http://chakra-project.org/tools-shaman.html
Afaik one can use it without the surrounding kde-mod. Anyways, in my experience most people prefer some graphical frontend because it gives them an overview of what is there, what to choose, and so on.

Offline

#6 2009-09-04 00:06:53

umpalumpa1985
Member
From: America
Registered: 2007-12-05
Posts: 134

Re: automatic upgrade/shutdown

That looks like just about what i need for this man.  Thank you very much for the help.


Never interrupt your enemy when he's making a mistake.    ~Napoleon Bonaparte

Offline

#7 2009-09-04 22:36:14

umpalumpa1985
Member
From: America
Registered: 2007-12-05
Posts: 134

Re: automatic upgrade/shutdown

ok on second thought, how about a cron job that executes a script. . .that logs into my bud's computer via ssh, makes an xdialog box that says to perform system upgrade, then logs back out ?


Never interrupt your enemy when he's making a mistake.    ~Napoleon Bonaparte

Offline

#8 2009-09-05 00:51:09

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: automatic upgrade/shutdown

umpalumpa, since he's your friend why don't you just ask him if it's ok to connect to his computer from time to time and do the updates yourself since it looks like you know how to do them.  Xine makes a good point that updates would be better done with proper supervention.  If you do ssh this shouldn't be much of a problem.

Off topic but your sig may have a problem with Forum Etiquette.


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#9 2009-09-05 01:24:34

umpalumpa1985
Member
From: America
Registered: 2007-12-05
Posts: 134

Re: automatic upgrade/shutdown

The thing is that i do the updates myself already.  I'm just a little tired of having to remember to do it all the time.  He knows how to do it also, and i have told him to IM me if a given list of packages that i gave him are to be upgraded so that i can monitor things myself.  I'm pretty sure if i just popped up a reminder on his comp every day he would take care of it himself.  That's why i cam up with what i thought was the brilliant idea of writing a script to make an xdialog box to do that.  I already log in every now and then to make an Xdialog box that tells him his computer is going to explode in 3 seconds, so i know that works just fine, i would just like it to be automated.  My apologies for the signature, i will remove the offensive material.


Never interrupt your enemy when he's making a mistake.    ~Napoleon Bonaparte

Offline

#10 2009-09-10 02:20:16

umpalumpa1985
Member
From: America
Registered: 2007-12-05
Posts: 134

Re: automatic upgrade/shutdown

so is there no way to log in and make an xdialog window to remind him at least?


Never interrupt your enemy when he's making a mistake.    ~Napoleon Bonaparte

Offline

#11 2009-09-10 02:29:01

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: automatic upgrade/shutdown

What about a script that checks the output of "pacman -Qu" and pops up a dialogue if there's something to update? You could run it as a cronjob once a day at whatever time you expect him to be in front of the computer.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#12 2009-09-10 03:29:39

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: automatic upgrade/shutdown

If he is using Gnome:

/usr/bin/zenity --warning --text "Do update"

You could wrap that in a script to use -Qu as Xyne suggested:

#!/bin/bash

pacman -Sy &> /dev/null

UPDATES=`pacman -Qu`
if [ -n "$UPDATES" ] ; then
   /usr/bin/zenity --warning --text "Do update"
fi

If he's really that hopeless at doing updates, I'd leave him alone to not to updates. If the systems working and he's happy, then there's no real need to update. When he wants to install a new app in 6 months time and he can't because of out-of-date dependencies, well he made the bed and then he'll have to sleep on it.

Last edited by fukawi2 (2009-09-10 03:32:47)

Offline

#13 2009-09-10 04:13:15

umpalumpa1985
Member
From: America
Registered: 2007-12-05
Posts: 134

Re: automatic upgrade/shutdown

Thanks for the help.  Actually, i already set up the warning box with zenity, the script to only show it if there are things to be updated is a nice touch.  thank you.


Never interrupt your enemy when he's making a mistake.    ~Napoleon Bonaparte

Offline

#14 2009-09-10 06:36:45

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: automatic upgrade/shutdown

You could even show him a list of the packages available to be updated:

pacman -Qu | zenity --list --column="Package" --text="The following updates are available for your system" --width=360 --height=480

Offline

#15 2009-09-10 12:06:48

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: automatic upgrade/shutdown

i prefer to live by the "never install arch for anyone" rule.

if he cant get around installing arch.. then he's better off with something else.

Offline

#16 2009-09-11 00:14:57

umpalumpa1985
Member
From: America
Registered: 2007-12-05
Posts: 134

Re: automatic upgrade/shutdown

I agree.  but he insisted, so i did.  And i've set up a script to show a list of packages that need updated, and then ask him whether he would like to perform the upgrade or not, with Xdialog.  It then shows output in an xterm window, confirming before any upgrade, of course.  This runs every day at 1700.  The rest is up to him.  Thank you for all the advice and tips.

-Johnny


Never interrupt your enemy when he's making a mistake.    ~Napoleon Bonaparte

Offline

#17 2009-09-11 02:09:53

pyther
Member
Registered: 2008-01-21
Posts: 1,395
Website

Re: automatic upgrade/shutdown

Just for shits and giggles: notify-send "Updates" "`pacman -Qu`"


Website - Blog - arch-home
Arch User since March 2005

Offline

#18 2009-09-11 22:39:21

umpalumpa1985
Member
From: America
Registered: 2007-12-05
Posts: 134

Re: automatic upgrade/shutdown

Nice.  I like it.  Thanks.  I'm probably gonna set this to run on my own box.  It's kind of convenient.


Never interrupt your enemy when he's making a mistake.    ~Napoleon Bonaparte

Offline

Board footer

Powered by FluxBB