Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nurlan
eepm
Commits
79e0adc4
Commit
79e0adc4
authored
Dec 08, 2012
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add systemd support
parent
a0e12ec8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
95 additions
and
6 deletions
+95
-6
serv-common
bin/serv-common
+17
-1
serv-disable
bin/serv-disable
+3
-0
serv-enable
bin/serv-enable
+3
-0
serv-start
bin/serv-start
+14
-1
serv-status
bin/serv-status
+44
-3
serv-stop
bin/serv-stop
+14
-1
No files found.
bin/serv-common
View file @
79e0adc4
...
@@ -21,5 +21,21 @@
...
@@ -21,5 +21,21 @@
# Common call service
# Common call service
serv_common
()
serv_common
()
{
{
sudocmd service
"
$@
"
local
SERVICE
=
"
$1
"
shift
case
$SERVICETYPE
in
service-chkconfig
)
sudocmd service
$SERVICE
"
$@
"
;;
service-update
)
sudocmd /etc/init.d/
$SERVICE
"
$@
"
;;
systemd
)
sudocmd systemctl
"
$@
"
$SERVICE
;;
*
)
fatal
"Do not known command for
$SERVICETYPE
"
;;
esac
}
}
bin/serv-disable
View file @
79e0adc4
...
@@ -34,6 +34,9 @@ serv_disable()
...
@@ -34,6 +34,9 @@ serv_disable()
service-update
)
service-update
)
sudocmd update-rc.d
$1
remove
sudocmd update-rc.d
$1
remove
;;
;;
systemd
)
sudocmd systemctl disable
$1
;;
*
)
*
)
fatal
"Do not known command for
$SERVICETYPE
"
fatal
"Do not known command for
$SERVICETYPE
"
;;
;;
...
...
bin/serv-enable
View file @
79e0adc4
...
@@ -34,6 +34,9 @@ serv_enable()
...
@@ -34,6 +34,9 @@ serv_enable()
service-update
)
service-update
)
sudocmd update-rc.d
$1
defaults
sudocmd update-rc.d
$1
defaults
;;
;;
systemd
)
sudocmd systemctl
enable
$1
;;
*
)
*
)
fatal
"Do not known command for
$SERVICETYPE
"
fatal
"Do not known command for
$SERVICETYPE
"
;;
;;
...
...
bin/serv-start
View file @
79e0adc4
...
@@ -21,5 +21,18 @@
...
@@ -21,5 +21,18 @@
# Start service
# Start service
serv_start
()
serv_start
()
{
{
sudocmd service
$1
start
case
$SERVICETYPE
in
service-chkconfig
)
sudocmd service
$1
start
;;
service-update
)
sudocmd /etc/init.d/
$1
start
;;
systemd
)
sudocmd systemctl start
$1
;;
*
)
fatal
"Do not known command for
$SERVICETYPE
"
;;
esac
}
}
bin/serv-status
View file @
79e0adc4
...
@@ -20,16 +20,57 @@
...
@@ -20,16 +20,57 @@
is_service_running
()
is_service_running
()
{
{
$SUDO
service
$1
status
>
/dev/null
case
$SERVICETYPE
in
service-chkconfig
)
$SUDO
service
$1
status
>
/dev/null
;;
service-update
)
$SUDO
/etc/init.d/
$1
status
>
/dev/null
;;
systemd
)
#sudocmd systemctl is-enabled $1
fatal
"FIXME: don't know how detect current startup state"
;;
*
)
fatal
"Do not known command for
$SERVICETYPE
"
;;
esac
}
}
is_service_autostart
()
is_service_autostart
()
{
{
LANG
=
C
$SUDO
chkconfig
$1
--list
|
grep
-q
"5:on"
case
$SERVICETYPE
in
service-chkconfig
)
LANG
=
C
$SUDO
chkconfig
$1
--list
|
grep
-q
"5:on"
;;
service-update
)
fatal
"FIXME: don't know how detect current startup state"
;;
systemd
)
sudocmd systemctl is-enabled
$1
;;
*
)
fatal
"Do not known command for
$SERVICETYPE
"
;;
esac
}
}
serv_status
()
serv_status
()
{
{
is_service_autostart
$1
&&
echo
"Service
$1
is sheduled to run on startup"
||
echo
"Service
$1
will NOT run on startup"
is_service_autostart
$1
&&
echo
"Service
$1
is sheduled to run on startup"
||
echo
"Service
$1
will NOT run on startup"
sudocmd service
$1
status
case
$SERVICETYPE
in
service-chkconfig
)
sudocmd service
$1
status
;;
service-update
)
sudocmd /etc/init.d/
$1
statuss
;;
systemd
)
sudocmd systemctl status
$1
;;
*
)
fatal
"Do not known command for
$SERVICETYPE
"
;;
esac
}
}
bin/serv-stop
View file @
79e0adc4
...
@@ -21,5 +21,18 @@
...
@@ -21,5 +21,18 @@
# Stop service
# Stop service
serv_stop
()
serv_stop
()
{
{
sudocmd service
$1
stop
case
$SERVICETYPE
in
service-chkconfig
)
sudocmd service
$1
stop
;;
service-update
)
sudocmd /etc/init.d/
$1
stop
;;
systemd
)
sudocmd systemctl stop
$1
;;
*
)
fatal
"Do not known command for
$SERVICETYPE
"
;;
esac
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment