qwell: branch 2.0 r5149 - /branches/2.0/scripts/rebootsystem.sh
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Thu Jan 27 11:51:00 CST 2011
Author: qwell
Date: Thu Jan 27 11:50:55 2011
New Revision: 5149
URL: http://svnview.digium.com/svn/asterisk-gui?view=rev&rev=5149
Log:
Add a script (currently unused) to reboot the system, rather than calling
reboot directly. This will let us attempt to gain root privs if we need them.
Ideally, we'd report the results back to the user if it fails.
Added:
branches/2.0/scripts/rebootsystem.sh (with props)
Added: branches/2.0/scripts/rebootsystem.sh
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/scripts/rebootsystem.sh?view=auto&rev=5149
==============================================================================
--- branches/2.0/scripts/rebootsystem.sh (added)
+++ branches/2.0/scripts/rebootsystem.sh Thu Jan 27 11:50:55 2011
@@ -1,0 +1,9 @@
+#!/bin/sh
+
+if [ `id -u` -eq 0 ]; then
+ # Since we're root, we can reboot directly (presumably).
+ reboot || exit 1
+else
+ # Attempt to reboot using sudo, otherwise fail.
+ sudo reboot 2>/dev/null || exit 1
+fi
Propchange: branches/2.0/scripts/rebootsystem.sh
------------------------------------------------------------------------------
svn:executable = *
More information about the asterisk-gui-commits
mailing list