Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a script that runs on centos 6 and want to try out centos 7 I am trying to convert the script to work with systemd
original script
Code:
start on runlevel [2345]
stop on runlevel [!2345]
env NUM_WORKERS=20
pre-start script
for i in `seq 1 $NUM_WORKERS`
do
start consumer-localhost N=$i
done
end script
so far I have
Code:
### BEGIN INIT INFO
Provides: localqueue
Default-Start: 2 3 4 5
Default-Stop: 0 1 6
Short-Description: start and stop service rabbitmq servers
Description: worker process to start multiple consumers - q9 mt03 local queue
Environment NUM_WORKERS=20
ExecStartPre
for i in `seq 1 $NUM_WORKERS`
do
start consumer-localhost N=$i
done
ExecStopPost
### END INIT INFO
### END INIT INFO
Init scripts are about the only things almost every distribution does differently.
I've written init scripts on SuSE/openSUSE and Debian based systems. There were different steps to take and different options to set to create an init script on those unrelated systems. CentOS appears even more different, so I really can't do much more than post this link which I think is quite good: https://techarena51.com/index.php/ho...t-on-centos-6/
This is for CentOS 6 though, not 7. I have no idea what might have changed.
Good luck and happy hacking!
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,521
Rep:
I usually just look at one of the other scripts and copy it, making the necessary changes. Most distros have a program to convert sysvinit scripts to systemd.
I usually just look at one of the other scripts and copy it, making the necessary changes. Most distros have a program to convert sysvinit scripts to systemd.
Thank you, but I been trying to find a similar example to the init.d script but cant find any, with the pre script, post script env variable and for loop.
Thank you, but I been trying to find a similar example to the init.d script but cant find any, with the pre script, post script env variable and for loop.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.