Initial
This commit is contained in:
51
bin/v-restart-system
Executable file
51
bin/v-restart-system
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
# info: restart operating system
|
||||
# options: RESTART [DELAY]
|
||||
#
|
||||
# example: v-restart-system yes
|
||||
#
|
||||
# This function restarts operating system.
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variables & Functions #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument definition
|
||||
restart=$1
|
||||
delay=$2
|
||||
|
||||
# Includes
|
||||
# shellcheck source=/etc/hestiacp/hestia.conf
|
||||
source /etc/hestiacp/hestia.conf
|
||||
# shellcheck source=/usr/local/hestia/func/main.sh
|
||||
source $HESTIA/func/main.sh
|
||||
# load config file
|
||||
source_conf "$HESTIA/conf/hestia.conf"
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '1' "$#" 'RESTART [DELAY]'
|
||||
|
||||
# Perform verification if read-only mode is enabled
|
||||
check_hestia_demo_mode
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
if [ "$restart" = 'yes' ]; then
|
||||
$BIN/v-log-action "system" "Warning" "System" "System restart initiated."
|
||||
if [ "$delay" ]; then
|
||||
echo "The server will restart in $delay seconds..."
|
||||
sleep "$delay"
|
||||
fi
|
||||
/sbin/reboot
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Hestia #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
exit
|
||||
Reference in New Issue
Block a user