File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2264,11 +2264,12 @@ function python_version {
22642264# Service wrapper to restart services
22652265# restart_service service-name
22662266function restart_service {
2267- if is_ubuntu ; then
2268- sudo /usr/sbin/service $1 restart
2267+ if [ -x /bin/systemctl ] ; then
2268+ sudo /bin/systemctl restart $1
22692269 else
2270- sudo /sbin/ service $1 restart
2270+ sudo service $1 restart
22712271 fi
2272+
22722273}
22732274
22742275# Only change permissions of a file or directory if it is not on an
@@ -2286,20 +2287,20 @@ function safe_chown {
22862287# Service wrapper to start services
22872288# start_service service-name
22882289function start_service {
2289- if is_ubuntu ; then
2290- sudo /usr/sbin/service $1 start
2290+ if [ -x /bin/systemctl ] ; then
2291+ sudo /bin/systemctl start $1
22912292 else
2292- sudo /sbin/ service $1 start
2293+ sudo service $1 start
22932294 fi
22942295}
22952296
22962297# Service wrapper to stop services
22972298# stop_service service-name
22982299function stop_service {
2299- if is_ubuntu ; then
2300- sudo /usr/sbin/service $1 stop
2300+ if [ -x /bin/systemctl ] ; then
2301+ sudo /bin/systemctl stop $1
23012302 else
2302- sudo /sbin/ service $1 stop
2303+ sudo service $1 stop
23032304 fi
23042305}
23052306
You can’t perform that action at this time.
0 commit comments