Jump to content
Read the Funtoo Newsletter: Summer 2023 ×

Help to convert CentOS script to OpenRC


dneto

Recommended Posts

Hi Friends,

 

Sorry for this n00b question. I already read the OpenRC documentation but I'm not able to make works well. In fact develop and scripting isn't my passion.

 

I have this script to CentOS systems:

[Unit]
Description=Blacklist monitor
[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/bin/php /var/www/localhost/htdocs/blacklistmonitor/service/blacklistmonitor.php >>/var/log/blacklistmonitor.log 2>&1

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

# how to setup for centos
# cp /var/www/html/blacklistmonitor/setup/blacklistmonitor-centos-systemd.conf /etc/systemd/system/blacklistmonitor.service
# systemctl restart blacklistmonitor.service
# systemctl stop blacklistmonitor.service
# systemctl start blacklistmonitor.service

Can anyone help me to make an OpenRC script?

 

 

 

 

Regards
 

Link to comment
Share on other sites

following these instruction would result something like this:

#!/sbin/runscript
 
SERVICE="/usr/bin/php /var/www/localhost/htdocs/blacklistmonitor/service/blacklistmonitor.php"
 
start() {
  ebegin "Starting my service"
  start-stop-daemon --start --background --exec $SERVICE --pidfile /run/blacklistmonitor.pid >> /var/log/blacklistmonitor.log 2>&1
  eend $?
}
 
stop() {
  start-stop-daemon --stop --exec $SERVICE --pidfile /run/blacklistmonitor.pid
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...