You are not logged in.
Pages: 1
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
try:
pacman -Syu && reboot
What you posted will pipe the output of pacman to the reboot command.
Offline
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
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
Offline
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
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
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
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
@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
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
@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
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
Sorry for confusing this.
Hail to the thief!
Offline
why would you want to reboot unless a new kernel has been pulled in?
Offline
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
Ah thanks for the input everyone.
why would you want to reboot unless a new kernel has been pulled in?
No harm in a reboot I guess 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
there's no harm to it, but there's no real reason for it either.
Offline
> 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
All this feedback has changed my mind somewhat!
I think i'd better refrain from automatic rebooting
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
Pages: 1