We live in a new systemd world, use the native commands to talk to it
if available.
Change-Id: Iccdc35f0c9da2997f9e672bc1d24ca15d3403d98
| ... | ... |
@@ -2264,11 +2264,12 @@ function python_version {
|
| 2264 | 2264 |
# Service wrapper to restart services |
| 2265 | 2265 |
# restart_service service-name |
| 2266 | 2266 |
function 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 |
|
| 2269 | 2269 |
else |
| 2270 |
- sudo /sbin/service $1 restart |
|
| 2270 |
+ sudo service $1 restart |
|
| 2271 | 2271 |
fi |
| 2272 |
+ |
|
| 2272 | 2273 |
} |
| 2273 | 2274 |
|
| 2274 | 2275 |
# Only change permissions of a file or directory if it is not on an |
| ... | ... |
@@ -2286,20 +2287,20 @@ function safe_chown {
|
| 2286 | 2286 |
# Service wrapper to start services |
| 2287 | 2287 |
# start_service service-name |
| 2288 | 2288 |
function start_service {
|
| 2289 |
- if is_ubuntu; then |
|
| 2290 |
- sudo /usr/sbin/service $1 start |
|
| 2289 |
+ if [ -x /bin/systemctl ]; then |
|
| 2290 |
+ sudo /bin/systemctl start $1 |
|
| 2291 | 2291 |
else |
| 2292 |
- sudo /sbin/service $1 start |
|
| 2292 |
+ sudo service $1 start |
|
| 2293 | 2293 |
fi |
| 2294 | 2294 |
} |
| 2295 | 2295 |
|
| 2296 | 2296 |
# Service wrapper to stop services |
| 2297 | 2297 |
# stop_service service-name |
| 2298 | 2298 |
function stop_service {
|
| 2299 |
- if is_ubuntu; then |
|
| 2300 |
- sudo /usr/sbin/service $1 stop |
|
| 2299 |
+ if [ -x /bin/systemctl ]; then |
|
| 2300 |
+ sudo /bin/systemctl stop $1 |
|
| 2301 | 2301 |
else |
| 2302 |
- sudo /sbin/service $1 stop |
|
| 2302 |
+ sudo service $1 stop |
|
| 2303 | 2303 |
fi |
| 2304 | 2304 |
} |
| 2305 | 2305 |
|