You are not logged in.

#1 2008-01-19 23:52:48

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

pacman -Syu followed by reboot

How do you use linux commands to make the system reboot automatically straight after upgrading (pacman -Syu)?

I tried:

pacman -Syu | reboot

but this doesn't seem to work as my computer reboots straight away.

Thanks.

Last edited by Jamie (2008-01-19 23:53:26)


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#2 2008-01-19 23:58:53

Endperform
Member
From: Atlanta GA, USA
Registered: 2007-09-04
Posts: 94
Website

Re: pacman -Syu followed by reboot

try:

pacman -Syu && reboot

What you posted will pipe the output of pacman to the reboot command.

Offline

#3 2008-01-20 12:13:16

harlekin
Member
From: Germany
Registered: 2006-07-13
Posts: 408

Re: pacman -Syu followed by reboot

Your example will pipe pacman's output to reboot, as mentioned by Endperform.

Endperform's example will only reboot if pacman's exit status is != 0. I don't know about pacman's exit statuses but I think 0 indicates a successful operation and != 0 indicates an error.

So this command will reboot the computer if pacman's operation was successful:

pacman -Syu || reboot

This command will reboot the computer if pacman's operation was *not* successful:

pacman -Syu && reboot

This command will reboot the computer after pacman has finished it's operation independent of pacman's exit code:

pacman -Syu; reboot

Remember pacman -Syu needs you to type y to install the packages. So (yes | pacman -Syu); reboot may be better than just pacman -Syu.

edit: Usage of || and && is wrong! See below.

Last edited by harlekin (2008-01-20 17:01:38)


Hail to the thief!

Offline

#4 2008-01-20 12:28:54

sykesm
Member
From: Reading, UK
Registered: 2006-09-03
Posts: 70

Re: pacman -Syu followed by reboot

correct me if I'm wrong guys, but it's preferable to look at what you plan to update, and answer Y or n to the pacman upgrade queries manualy, the recent episode with qt being a perfect example, not to mention kernel or xorg upgrades. You realy should think about it.

Last edited by sykesm (2008-01-20 12:29:36)

Offline

#5 2008-01-20 12:34:42

ise
Developer
From: Karlsruhe / Germany
Registered: 2005-10-06
Posts: 404
Website

Re: pacman -Syu followed by reboot

The next thing is, that important message will be printed out after each package. Automatically rebooting after updating isn't really a good idea.
But if you just want a proof of concept if it works, then harlekin's post is the right one.

Offline

#6 2008-01-20 12:36:31

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: pacman -Syu followed by reboot

Thanks for the help people.

@sykesm: Hmmm this could be why KeePassX is all screwed up on my computer. It's turned a nice shade of black tongue
And also, I will probably run the "pacman -Syu; reboot" command without an automatic yes. I merely want an automatic reboot, especially after a big download, so I can just leave it going and once its finished I don't have to reboot myself.

Last edited by Jamie (2008-01-20 12:37:03)


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#7 2008-01-20 12:38:28

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: pacman -Syu followed by reboot

ise wrote:

The next thing is, that important message will be printed out after each package. Automatically rebooting after updating isn't really a good idea.
But if you just want a proof of concept if it works, then harlekin's post is the right one.

Hmm, with both you and sykesm suggesting otherwise, I might reconsider saving myself time and do it the safe way cool


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#8 2008-01-20 14:47:07

ibendiben
Member
Registered: 2007-10-10
Posts: 519

Re: pacman -Syu followed by reboot

@HARLEKIN

So sorry but have a look at this:

The control operators && and || denote AND lists and OR lists, respectively. An AND list has the form

    command && command2

command2 is executed if, and only if, command returns an exit status of zero.

An OR list has the form

    command || command2

command2 is executed if and only if command returns a non-zero exit status. The return status of AND and OR lists is the exit status of the last command executed in the list.

You got thing mixed up there mad

So Endperform was quite right AFAIK. I woudn't recomment to use this tough, it is good to have things under control and be able to read all of pacmans output/questions. (each case you can have a look at the log though)

Offline

#9 2008-01-20 14:51:49

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: pacman -Syu followed by reboot

ibendiben wrote:

@HARLEKIN

So sorry but have a look at this:

The control operators && and || denote AND lists and OR lists, respectively. An AND list has the form

    command && command2

command2 is executed if, and only if, command returns an exit status of zero.

An OR list has the form

    command || command2

command2 is executed if and only if command returns a non-zero exit status. The return status of AND and OR lists is the exit status of the last command executed in the list.

You got thing mixed up there mad

So Endperform was quite right AFAIK. I woudn't recomment to use this tough, it is good to have things under control and be able to read all of pacmans output/questions. (each case you can have a look at the log though)

heh yeah i was confused at reading his post because i do sleep XX && halt every night and the logic didn't make sense lol.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#10 2008-01-20 17:01:02

harlekin
Member
From: Germany
Registered: 2006-07-13
Posts: 408

Re: pacman -Syu followed by reboot

Sorry for confusing this.


Hail to the thief!

Offline

#11 2008-01-20 17:44:59

b9anders
Member
Registered: 2007-11-07
Posts: 691

Re: pacman -Syu followed by reboot

why would you want to reboot unless a new kernel has been pulled in?

Offline

#12 2008-01-20 22:16:49

loosec
Member
Registered: 2007-03-08
Posts: 134

Re: pacman -Syu followed by reboot

Pacman has the switch --noconfirm so no need to pipe yes into it. Ok, it's more text but I prefer it.
pacman -Syu --noconfirm

Offline

#13 2008-01-21 00:28:30

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: pacman -Syu followed by reboot

Ah thanks for the input everyone.

b9anders wrote:

why would you want to reboot unless a new kernel has been pulled in?

No harm in a reboot I guess smile I usually run the system update whenever i'm busy and about to go do something else. This way, it reboots automatically, new kernel or not, and saves me some time with a computer that's ready to go regardless of what was updated.

Last edited by Jamie (2008-01-21 00:28:46)


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#14 2008-01-23 00:18:29

b9anders
Member
Registered: 2007-11-07
Posts: 691

Re: pacman -Syu followed by reboot

there's no harm to it, but there's no real reason for it either.

Offline

#15 2008-01-23 01:44:29

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: pacman -Syu followed by reboot

> I usually run the system update whenever i'm busy and about to go do something else.

The system update is exactly the one thing you should do with your utmost attention. Everything else that's normally more important and productive won't matter, once you've screwed your system due to not reading the upgrade output. Also have a look at the frontpage news from time to time (RSS is available too) or even subscribe to the arch-announce list to get a bigger picture of the changes to come.


1000

Offline

#16 2008-01-23 09:45:49

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: pacman -Syu followed by reboot

All this feedback has changed my mind somewhat!

I think i'd better refrain from automatic rebooting smile

Thanks for the help all.

Last edited by Jamie (2008-01-23 09:46:05)


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

Board footer

Powered by FluxBB