You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							52 lines
						
					
					
						
							1.5 KiB
						
					
					
				
			
		
		
	
	
							52 lines
						
					
					
						
							1.5 KiB
						
					
					
				#!/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
 |