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
etersoft
eepm
Commits
0f4d8688
Commit
0f4d8688
authored
Dec 08, 2012
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for primitive (script only) service system, add support for upstart service syste
parent
e93d24b8
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
33 additions
and
29 deletions
+33
-29
serv
bin/serv
+5
-4
serv-common
bin/serv-common
+2
-2
serv-disable
bin/serv-disable
+2
-2
serv-enable
bin/serv-enable
+2
-2
serv-list
bin/serv-list
+9
-6
serv-list_all
bin/serv-list_all
+1
-1
serv-list_startup
bin/serv-list_startup
+1
-1
serv-start
bin/serv-start
+2
-2
serv-status
bin/serv-status
+5
-5
serv-stop
bin/serv-stop
+2
-2
serv-try_restart
bin/serv-try_restart
+2
-2
No files found.
bin/serv
View file @
0f4d8688
...
@@ -36,7 +36,8 @@ check_tty
...
@@ -36,7 +36,8 @@ check_tty
#############################
#############################
# FIXME: detect if not recognized
# FIXME: detect by real init system
# FIXME: add upstart support (Ubuntu?)
set_service_type
()
set_service_type
()
{
{
local
CMD
local
CMD
...
@@ -69,9 +70,9 @@ case $DISTRNAME in
...
@@ -69,9 +70,9 @@ case $DISTRNAME in
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific
)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific
)
CMD
=
"service-chkconfig"
CMD
=
"service-chkconfig"
;;
;;
#
Slackware)
Slackware
)
# CMD="slackpkg
"
CMD
=
"service-initd
"
#
;;
;;
SUSE|SLED|SLES
)
SUSE|SLED|SLES
)
CMD
=
"service-chkconfig"
CMD
=
"service-chkconfig"
;;
;;
...
...
bin/serv-common
View file @
0f4d8688
...
@@ -24,10 +24,10 @@ serv_common()
...
@@ -24,10 +24,10 @@ serv_common()
local
SERVICE
=
"
$1
"
local
SERVICE
=
"
$1
"
shift
shift
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig
)
service-chkconfig
|service-upstart
)
sudocmd service
$SERVICE
"
$@
"
sudocmd service
$SERVICE
"
$@
"
;;
;;
service-update
)
service-
initd|service-
update
)
sudocmd /etc/init.d/
$SERVICE
"
$@
"
sudocmd /etc/init.d/
$SERVICE
"
$@
"
;;
;;
systemd
)
systemd
)
...
...
bin/serv-disable
View file @
0f4d8688
...
@@ -28,10 +28,10 @@ serv_disable()
...
@@ -28,10 +28,10 @@ serv_disable()
is_service_autostart
$1
||
{
echo
"Service
$1
already disabled for startup"
&&
return
;
}
is_service_autostart
$1
||
{
echo
"Service
$1
already disabled for startup"
&&
return
;
}
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig
)
service-chkconfig
|service-upstart
)
sudocmd chkconfig
$1
off
sudocmd chkconfig
$1
off
;;
;;
service-update
)
service-
initd|service-
update
)
sudocmd update-rc.d
$1
remove
sudocmd update-rc.d
$1
remove
;;
;;
systemd
)
systemd
)
...
...
bin/serv-enable
View file @
0f4d8688
...
@@ -28,10 +28,10 @@ serv_enable()
...
@@ -28,10 +28,10 @@ serv_enable()
is_service_autostart
$1
&&
echo
"Service
$1
already enabled for startup"
&&
return
is_service_autostart
$1
&&
echo
"Service
$1
already enabled for startup"
&&
return
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig
)
service-chkconfig
|service-upstart
)
sudocmd chkconfig
$1
on
sudocmd chkconfig
$1
on
;;
;;
service-update
)
service-
initd|service-
update
)
sudocmd update-rc.d
$1
defaults
sudocmd update-rc.d
$1
defaults
;;
;;
systemd
)
systemd
)
...
...
bin/serv-list
View file @
0f4d8688
...
@@ -22,12 +22,15 @@
...
@@ -22,12 +22,15 @@
serv_list
()
serv_list
()
{
{
case
$SERVICETYPE
in
case
$SERVICETYPE
in
# service-chkconfig)
service-chkconfig|service-upstart
)
# sudocmd service $1 stop
sudocmd service
--status-all
# ;;
;;
# service-update)
service-upstart
)
# sudocmd /etc/init.d/$1 stop
sudocmd initctl list
# ;;
;;
service-update
)
sudocmd service
--status-all
;;
systemd
)
systemd
)
sudocmd systemctl list-units
sudocmd systemctl list-units
;;
;;
...
...
bin/serv-list_all
View file @
0f4d8688
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
serv_list_all
()
serv_list_all
()
{
{
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig
)
service-chkconfig
|service-upstart
)
# service --status-all for Ubuntu/Fedora
# service --status-all for Ubuntu/Fedora
sudocmd chkconfig
--list
|
cut
-f1
sudocmd chkconfig
--list
|
cut
-f1
;;
;;
...
...
bin/serv-list_startup
View file @
0f4d8688
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
serv_list_startup
()
serv_list_startup
()
{
{
case
$SERVICETYPE
in
case
$SERVICETYPE
in
# service-chkconfig)
# service-chkconfig
|service-upstart
)
# # service --status-all for Ubuntu/Fedora
# # service --status-all for Ubuntu/Fedora
# #sudocmd chkconfig --list | cut -f1
# #sudocmd chkconfig --list | cut -f1
# ;;
# ;;
...
...
bin/serv-start
View file @
0f4d8688
...
@@ -22,10 +22,10 @@
...
@@ -22,10 +22,10 @@
serv_start
()
serv_start
()
{
{
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig
)
service-chkconfig
|service-upstart
)
sudocmd service
$1
start
sudocmd service
$1
start
;;
;;
service-update
)
service-
initd|service-
update
)
sudocmd /etc/init.d/
$1
start
sudocmd /etc/init.d/
$1
start
;;
;;
systemd
)
systemd
)
...
...
bin/serv-status
View file @
0f4d8688
...
@@ -21,10 +21,10 @@
...
@@ -21,10 +21,10 @@
is_service_running
()
is_service_running
()
{
{
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig
)
service-chkconfig
|service-upstart
)
$SUDO
service
$1
status
>
/dev/null
$SUDO
service
$1
status
>
/dev/null
;;
;;
service-update
)
service-
initd|service-
update
)
$SUDO
/etc/init.d/
$1
status
>
/dev/null
$SUDO
/etc/init.d/
$1
status
>
/dev/null
;;
;;
systemd
)
systemd
)
...
@@ -40,10 +40,10 @@ is_service_running()
...
@@ -40,10 +40,10 @@ is_service_running()
is_service_autostart
()
is_service_autostart
()
{
{
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig
)
service-chkconfig
|service-upstart
)
LANG
=
C
$SUDO
chkconfig
$1
--list
|
grep
-q
"5:on"
LANG
=
C
$SUDO
chkconfig
$1
--list
|
grep
-q
"5:on"
;;
;;
service-update
)
service-
initd|service-
update
)
fatal
"FIXME: don't know how detect current startup state"
fatal
"FIXME: don't know how detect current startup state"
;;
;;
systemd
)
systemd
)
...
@@ -60,7 +60,7 @@ serv_status()
...
@@ -60,7 +60,7 @@ 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"
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig
)
service-chkconfig
|service-upstart
)
sudocmd service
$1
status
sudocmd service
$1
status
;;
;;
service-update
)
service-update
)
...
...
bin/serv-stop
View file @
0f4d8688
...
@@ -22,10 +22,10 @@
...
@@ -22,10 +22,10 @@
serv_stop
()
serv_stop
()
{
{
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig
)
service-chkconfig
|service-upstart
)
sudocmd service
$1
stop
sudocmd service
$1
stop
;;
;;
service-update
)
service-
initd|service-
update
)
sudocmd /etc/init.d/
$1
stop
sudocmd /etc/init.d/
$1
stop
;;
;;
systemd
)
systemd
)
...
...
bin/serv-try_restart
View file @
0f4d8688
...
@@ -24,11 +24,11 @@ load_helper serv-status
...
@@ -24,11 +24,11 @@ load_helper serv-status
serv_try_restart
()
serv_try_restart
()
{
{
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig
)
service-chkconfig
|service-upstart
)
is_service_running
$1
||
return
0
is_service_running
$1
||
return
0
sudocmd service
$1
restart
sudocmd service
$1
restart
;;
;;
service-update
)
service-
initd|service-
update
)
is_service_running
$1
||
return
0
is_service_running
$1
||
return
0
sudocmd /etc/init.d/
$1
restart
sudocmd /etc/init.d/
$1
restart
;;
;;
...
...
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