[ZBXNEXT-2229] SysV init script for Zabbix server/agent Created: 2014 Mar 28  Updated: 2018 Mar 20

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: Installation (I)
Affects Version/s: 2.0.10
Fix Version/s: None

Type: Change Request Priority: Trivial
Reporter: Dumitru Moldovan Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: initscripts
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified
Environment:

Linux, AIX, Solaris, other Unices.


Attachments: File sysv_init_script.sh     File sysv_init_script.sh     File sysv_init_script.sh     File sysv_init_script.sh     File sysv_init_script.sh     File sysv_init_script.sh     File sysv_init_script.sh    
Issue Links:
Duplicate
is duplicated by ZBXNEXT-2730 SysV init script for Zabbix agent/ser... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
ZBXNEXT-2730 SysV init script for Zabbix agent/ser... Change Request (Sub-task) Closed  

 Description   

Wrote a portable SysV init script for the Zabbix agent/server 2.0.10. Started to write it from scratch for AIX 5.3 and included all features found in Unix init scripts included with Zabbix or available on the Internet. We use it in Solaris 10 too. It was also tested for both agent and server in Ubuntu 12.04.



 Comments   
Comment by Dumitru Moldovan [ 2014 Mar 28 ]

Version that also works in Solaris.

Comment by Dumitru Moldovan [ 2014 Mar 28 ]

Somehow managed to upload at 16:49 a version that was only tested in AIX and Linux. The one from 17:06 also includes fixes for Solaris' ancient /bin/sh.

Comment by Dumitru Moldovan [ 2014 Apr 02 ]

Added support for force-stop action.

Comment by Dumitru Moldovan [ 2014 Apr 02 ]

Added support for force-stop action in the latest attached file (2014 Apr 02). Tested in AIX 5.3, Solaris 10 and Ubuntu 12.04.

The commands in action:

# /etc/init.d/zabbix-agent start
Starting Zabbix agent:  Done.
# /etc/init.d/zabbix-agent status
Zabbix agent is running.
# /etc/init.d/zabbix-agent stop
Stopping Zabbix agent: .. Done.
# /etc/init.d/zabbix-agent status
No zabbix_agentd process is running as user zabbix.
Zabbix agent is not running!
# /etc/init.d/zabbix-agent stop
No zabbix_agentd process is running as user zabbix.
Zabbix agent is not running, nothing to do.
# /etc/init.d/zabbix-agent start
Starting Zabbix agent:  Done.
# /etc/init.d/zabbix-agent start
Zabbix agent is already running, nothing to do.
# /etc/init.d/zabbix-agent restart
Stopping Zabbix agent: .. Done.
Starting Zabbix agent:  Done.
# /etc/init.d/zabbix-agent force-stop
Zabbix agent is running fine, initiating normal stop...
Stopping Zabbix agent: .. Done.
# /etc/init.d/zabbix-agent force-stop
No zabbix_agentd process is running as user zabbix.
Zabbix agent is not running, nothing to do.
# /etc/init.d/zabbix-agent restart
No zabbix_agentd process is running as user zabbix.
Zabbix agent is not running, nothing to do.
Starting Zabbix agent:  Done.
# rm /var/run/zabbix/zabbix_agentd.pid 
# /etc/init.d/zabbix-agent status
Problems reading PID from file /var/run/zabbix/zabbix_agentd.pid.
Zabbix agent is not properly running!
# /etc/init.d/zabbix-agent restart
Problems reading PID from file /var/run/zabbix/zabbix_agentd.pid.
Zabbix agent is not properly running, not stopping!
Zabbix agent was not properly stopped, not starting!
# /etc/init.d/zabbix-agent force-stop
Problems reading PID from file /var/run/zabbix/zabbix_agentd.pid.
Zabbix agent is not properly running, killing it nicely first: .. Done.
# /etc/init.d/zabbix-agent status
No zabbix_agentd process is running as user zabbix.
Zabbix agent is not running!
# /etc/init.d/zabbix-agent start
Starting Zabbix agent:  Done.
# kill -9 `cat /var/run/zabbix/zabbix_agentd.pid`
# /etc/init.d/zabbix-agent status
PID from /var/run/zabbix/zabbix_agentd.pid doesn't match running processes.
Zabbix agent is not properly running!
# /etc/init.d/zabbix-agent restart
PID from /var/run/zabbix/zabbix_agentd.pid doesn't match running processes.
Zabbix agent is not properly running, not stopping!
Zabbix agent was not properly stopped, not starting!
# /etc/init.d/zabbix-agent force-stop
PID from /var/run/zabbix/zabbix_agentd.pid doesn't match running processes.
Zabbix agent is not properly running, killing it nicely first: . Done.
# /etc/init.d/zabbix-agent status
No zabbix_agentd process is running as user zabbix.
Zabbix agent is not running!
Comment by Dumitru Moldovan [ 2014 Jun 27 ]

A slightly improved version.

Comment by Dumitru Moldovan [ 2015 Mar 02 ]

Updated for HP-UX 11.31.

Comment by Dumitru Moldovan [ 2015 Mar 05 ]

Fix minor issue with shells that do not implement the KornShell-derived conditional command (double bracket [[]]), eg. Solaris' ancient /bin/sh and Ubuntu's Dash.

Comment by Dumitru Moldovan [ 2018 Mar 20 ]

Slightly improved version. Integrates with RHEL's chkconfig, tested in RHEL 7.

Comment by Dumitru Moldovan [ 2018 Mar 20 ]

The init script should work with 3.x versions as well, currently tested with 3.0 LTS.

Generated at Sun May 18 08:47:36 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.