Tag Info

Hot answers tagged

2

You run the risk of causing filesystem inconsistencies. It is better, even when out of RAM, as this normally still works in such situations, to use the alt-sysrq sequence, as that will attempt to shut things down as cleanly as possible (if it fails, then you're no worse off than if you pressed the power button, but if it succeeds then you're potentially ...


2

Try putting the script in different runlevels. /etc/rc0.d - While system shuts down. /etc/rcS.d - While system boots /etc/rc1.d - Working as singel user (user specific on login) /etc/rc2.d - Working as multiple users /etc/rc3.d bis /etc/rc5.d - not used in ubuntu /etc/rc6.d - While system restarts


1

Solved. The thing I didn't take into account is that the script is exectuted as root and not with my user. So when running ssh, password is required as I only set up the keys for my user. The workaround I used is forcing ssh to use my user keys: ssh -i /home/user/.ssh/id_rsa user@remote sudo halt


1

Restart machine In grub menu choose advanced option Select "recovery" item In window menu choose "root" Type: passwd user_name reboot Your grub menu is probably hidden - so you need to use keyboard (ESC) to see it :-) You can also use live-cd distro to do this task. mount your "/" partition (let say: /media/sda1), and use chroot /media/sda1. Then type ...


1

If you have docky installed this fixed the problem for both of my machines. Ubuntu 15.04 Unity + Docky, Plank, or Cairo-Dock (DOCKY) cd ~/.config/autostart nano docky.desktop add X-GNOME-Autostart-Delay=20 (IF YOU USE CAIRODOCK) cd ~/.config/autostart nano cairo-dock.desktop add X-GNOME-Autostart-Delay=20 Or you can just remove either one from ...


1

If you have docky installed this fixed the problem for both of my machines. Ubuntu 15.04 Unity + Docky, Cairo-Dock, or Plank (DOCKY) cd ~/.config/autostart nano docky.desktop add X-GNOME-Autostart-Delay=20 (IF YOU USE CAIRODOCK) cd ~/.config/autostart nano cairo-dock.desktop add X-GNOME-Autostart-Delay=20 Or you can remove either one from autostart. ...


1

Alright, so I stumbled upon the answer to my own question quite by accident. I probably should've mentioned this before, but I also tried to find out what keycode and keysym the power key was attached to through xev, but it registered nothing when the key was pressed. Anyhow, I just recently changed over from using the Xmonad window manager to the i3 ...


1

No, you can't make that setup using HandlePowerKey entry for systemd. It is not a script hook, just a predefined options. HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, HandleLidSwitch=, HandleLidSwitchDocked= Controls whether logind shall handle the system power and sleep keys and the lid switch to trigger actions such as system ...


1

Shutdown: /usr/lib/indicator-session/gtk-logout-helper --shutdown Reboot /usr/lib/indicator-session/gtk-logout-helper --restart Logout /usr/lib/indicator-session/gtk-logout-helper --logout You can also use another dialog: gnome-session-quit --power-off


1

The package that handles the AC-to-battery transition is pm-utils. On a command line, looking at the files in the pm-utils package will tell you where to go next: $ dpkg -L pm-utils ...<snip>... /usr/share/man/man1/pm-is-supported.1.gz /usr/share/man/man8/pm-powersave.8.gz /usr/share/man/man8/pm-action.8.gz ...<snip>... ...


1

… how can I send commands to terminal from my program … Using system, eg: #include <stdio.h> #include <stdlib.h> int main() { system("/bin/ls -la"); } or #include <stdio.h> #include <stdlib.h> int main() { system("sudo shutdown"); } Example % gcc foo.cpp % ./a.out [sudo] password for aboettger: % cat foo.cpp ...


1

You can use system() function defined in the header stdlib.h. #include<stdlib.h> int main() { system("dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 \"org.freedesktop.login1.Manager.PowerOff\" boolean:true"); retrun 0; } This is advised over sudo shutdown because the former doesnot require root ...


1

Since you're already root, instead of the complicated su -c "sudo /home/programer/bin/halt" user-name password - keep it simple /sbin/halt


1

I had similar problem to yours, would try to shut down or restart but the computer would go a black screen and would not power off. My computer has the same cpu. I found the solution is to blacklist a couple of drivers as found in this link http://forums.linuxmint.com/viewtopic.php?f=42&t=163126&start=20#p961212 . OldFred from Ubuntu forums pointed ...



Only top voted, non community-wiki answers of a minimum length are eligible