summaryrefslogtreecommitdiff
path: root/zen/shutdown.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <shieldwed@outlook.com>2018-05-09 00:07:03 +0200
committerDaniel Wilhelm <shieldwed@outlook.com>2018-05-09 00:07:03 +0200
commit1aab211abb68b40cefb5024d0be373589c9c8f99 (patch)
tree2da4ead196df622081ac45b29678e92ed30476a3 /zen/shutdown.cpp
parent9.5 (diff)
downloadFreeFileSync-1aab211abb68b40cefb5024d0be373589c9c8f99.tar.gz
FreeFileSync-1aab211abb68b40cefb5024d0be373589c9c8f99.tar.bz2
FreeFileSync-1aab211abb68b40cefb5024d0be373589c9c8f99.zip
9.6
Diffstat (limited to 'zen/shutdown.cpp')
-rwxr-xr-xzen/shutdown.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/zen/shutdown.cpp b/zen/shutdown.cpp
index b21ab8db..dd02814f 100755
--- a/zen/shutdown.cpp
+++ b/zen/shutdown.cpp
@@ -1,6 +1,6 @@
// *****************************************************************************
// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 *
+// * GNU General Public License: https://www.gnu.org/licenses/gpl-3.0 *
// * Copyright (C) Zenju (zenju AT freefilesync DOT org) - All Rights Reserved *
// *****************************************************************************
@@ -17,18 +17,16 @@ void zen::shutdownSystem() //throw FileError
{
//https://linux.die.net/man/2/reboot => needs admin rights!
- //should work without admin rights:
+ //"systemctl" should work without admin rights:
shellExecute("sleep 1; systemctl poweroff", EXEC_TYPE_ASYNC); //throw FileError
//sleep 1: give FFS some time to properly shut down!
- //Linux: main thread will wait on detached threads!
- warn_static("get rid of shellExecute's thread implementation!")
}
void zen::suspendSystem() //throw FileError
{
- //should work without admin rights:
+ //"systemctl" should work without admin rights:
shellExecute("systemctl suspend", EXEC_TYPE_ASYNC); //throw FileError
}
@@ -38,25 +36,25 @@ Command line alternatives:
#ifdef ZEN_WIN
#ifdef ZEN_WIN_VISTA_AND_LATER
- Shut down: shutdown /s /t 60
- Sleep: rundll32.exe powrprof.dll,SetSuspendState Sleep
- Log off: shutdown /l
+ Shut down: shutdown /s /t 60
+ Sleep: rundll32.exe powrprof.dll,SetSuspendState Sleep
+ Log off: shutdown /l
#else //XP
- Shut down: shutdown -s -t 60
- Standby: rundll32.exe powrprof.dll,SetSuspendState //this triggers standby OR hibernate, depending on whether hibernate setting is active! no suspend on XP?
- Log off: shutdown -l
+ Shut down: shutdown -s -t 60
+ Standby: rundll32.exe powrprof.dll,SetSuspendState //this triggers standby OR hibernate, depending on whether hibernate setting is active! no suspend on XP?
+ Log off: shutdown -l
#endif
#elif defined ZEN_LINUX
- Shut down: systemctl poweroff //alternative requiring admin: sudo shutdown -h 1
- Sleep: systemctl suspend //alternative requiring admin: sudo pm-suspend
- Log off: gnome-session-quit --no-prompt
- //alternative requiring admin: sudo killall Xorg
- //alternative without admin: dbus-send --session --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.Logout uint32:1
+ Shut down: systemctl poweroff //alternative requiring admin: sudo shutdown -h 1
+ Sleep: systemctl suspend //alternative requiring admin: sudo pm-suspend
+ Log off: gnome-session-quit --no-prompt
+ //alternative requiring admin: sudo killall Xorg
+ //alternative without admin: dbus-send --session --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.Logout uint32:1
#elif defined ZEN_MAC
- Shut down: osascript -e 'tell application "System Events" to shut down'
- Sleep: osascript -e 'tell application "System Events" to sleep'
- Log off: osascript -e 'tell application "System Events" to log out'
+ Shut down: osascript -e 'tell application "System Events" to shut down'
+ Sleep: osascript -e 'tell application "System Events" to sleep'
+ Log off: osascript -e 'tell application "System Events" to log out'
#endif
*/
bgstack15