Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
archutils
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
archlinux
archutils
Commits
49b6c115
Commit
49b6c115
authored
9 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
checkserices: Improve display of services to restart
parent
6e01114f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
checkservices
+5
-3
5 additions, 3 deletions
checkservices
with
5 additions
and
3 deletions
checkservices
+
5
−
3
View file @
49b6c115
...
@@ -29,7 +29,7 @@ SYSTEMD_CGROUP_BASE_PATH='/sys/fs/cgroup/systemd'
...
@@ -29,7 +29,7 @@ SYSTEMD_CGROUP_BASE_PATH='/sys/fs/cgroup/systemd'
if
[[
-t
1
]]
;
then
if
[[
-t
1
]]
;
then
shopt
-s
xpg_echo
shopt
-s
xpg_echo
c_title
=
'\e[1;33m'
c_title
=
'\e[1;33m'
c_svc
=
'\e[1;3
1
m'
c_svc
=
'\e[1;3
5
m'
c_warn
=
'\e[5;30;43m'
c_warn
=
'\e[5;30;43m'
c_error
=
'\e[5;30;41m'
c_error
=
'\e[5;30;41m'
c_rst
=
'\e[m'
c_rst
=
'\e[m'
...
@@ -160,15 +160,17 @@ for svc in "${services[@]}"; do
...
@@ -160,15 +160,17 @@ for svc in "${services[@]}"; do
done
done
# display what we will do
# display what we will do
((
"
${#
needy
[*]
}
"
))
&&
echo
'-------8<-------------------------------8<---------'
for
svc
in
"
${
needy
[@]
}
"
;
do
for
svc
in
"
${
needy
[@]
}
"
;
do
echo
"systemctl restart '
$svc
'"
echo
"systemctl restart '
$svc
'"
done
done
((
"
${#
needy
[*]
}
"
))
&&
echo
'-------8<-------------------------------8<---------'
# if nothing to restart we have done
# if nothing to restart we have done
((
$restart
==
0
||
${#
needy
[*]
}
==
0
))
&&
exit
0
((
$restart
==
0
||
${#
needy
[*]
}
==
0
))
&&
exit
0
# wait the timeout
# wait the timeout
((
$timeout
>
0
))
&&
{
((
$timeout
))
&&
{
echo
"Waiting for
${
timeout
}
seconds"
echo
"Waiting for
${
timeout
}
seconds"
echo
"Use Ctrl+C to undo"
echo
"Use Ctrl+C to undo"
sleep
$timeout
sleep
$timeout
...
@@ -176,8 +178,8 @@ done
...
@@ -176,8 +178,8 @@ done
# do the job, restart updated services
# do the job, restart updated services
for
svc
in
"
${
needy
[@]
}
"
;
do
for
svc
in
"
${
needy
[@]
}
"
;
do
echo
"Restarting
${
c_svc
}
$svc
${
c_rst
}
"
systemctl restart
"
$svc
"
&
systemctl restart
"
$svc
"
&
# wait process to terminate when serialize
((
$serialize
))
&&
wait
((
$serialize
))
&&
wait
# display status directly when serialize and not quiet
# display status directly when serialize and not quiet
((
$serialize
))
&&
((
$status
))
&&
systemctl
--lines
=
0 status
"
$svc
"
((
$serialize
))
&&
((
$status
))
&&
systemctl
--lines
=
0 status
"
$svc
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment