Hello, I just install the newest version of Centos 7 and I am a bit disappointed with new /etc/rc/local file I found that it's not usable anymore. *[root at lab3 ~]# cat /etc/rc.local* " THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES" It is highly advisable to create own systemd services or udev rules to run scripts during boot instead of using this file. Usually I was added my script to /etc/rc.local *[root at lab3 ~]# echo /usr/bin/bash /opt/ssh_tunnel.sh >> /etc/rc.local* And it was working perfect. What I should do in new Centos 7, please help. *--* *Best regards.* *Alex Berber* *+9 72 54 285 952 3* *www.linuxspace.org* <http://www.linuxspace.org/>
rc.local is systemV CentOS 7 is systemD Adam King IT Systems Administrator Skipton Girls High School 01756 707600 www.sghs.org.uk ----- Original Message ----- From: "Alan Holt" <berber.it at gmail.com> To: centos at centos.org Sent: Wednesday, August 20, 2014 2:07:59 PM Subject: [CentOS] Run script at startup Hello, I just install the newest version of Centos 7 and I am a bit disappointed with new /etc/rc/local file I found that it's not usable anymore. *[root at lab3 ~]# cat /etc/rc.local* " THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES" It is highly advisable to create own systemd services or udev rules to run scripts during boot instead of using this file. Usually I was added my script to /etc/rc.local *[root at lab3 ~]# echo /usr/bin/bash /opt/ssh_tunnel.sh >> /etc/rc.local* And it was working perfect. What I should do in new Centos 7, please help. *--* *Best regards.* *Alex Berber* *+9 72 54 285 952 3* *www.linuxspace.org* <http://www.linuxspace.org/> _______________________________________________ CentOS mailing list CentOS at centos.org http://lists.centos.org/mailman/listinfo/centos
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Alan Holt wrote on 20/08/2014 15:07:> I just install the newest version of Centos 7 and I am a bit disappointed > with new /etc/rc/local file I found that it's not usable anymore.You can re-enable it with this command: systemctl enable rc-local.service that enables the Unit /etc/systemd/system/rc-local.service Once you are familiar with systemd it is better to create a custom Unit for your purposes rather than using old rc.local Ciao, luigi - -- / +--[Luigi Rosa]-- \ Only one human captain has ever survived battle with a Minbari fleet. He is behind me. You are in front of me. If you value your lives, be somewhere else. --Delenn "Severed Dreams" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJT9J/FAAoJEO5WT/qgw4yKYioP/25AYAjcha/htV/nSAH3Qojn zznFFAk0AER6LbgLyle9SrTaq9aERYzepTdeOj+DD1OgWAfUMZgODiHhAqXI/NV0 pE28tAr1SulBS2mvrhFZUtBlzhGHrNzXfhuUpfkRP4mjbUNS7mfV/rOBlzZCUVHp yhv/30DOJIYyqSmpqFUQBY4Detywgu6pDj6eHbm6NABu/EP5KLw+DEyHIvOI+EVT nwwK1xH7R+lTUVCkLuF/eLJfngdvyBqWgaoB5kMOhP2yfXKanCybJDTa+pEhTQiv Ofi/gkEko0tVfjrAhNM24JX3awt3LpP9J9VVTWloE85eOA8tEtdzgBpQW0kuDb2S /DcYLwWSQ6/kDKGKDBHcohnkAKX/j0MJd8bCw1YuIVQPIUS21qU4V4TU9W0DLbFA d20o4174l2GcRyqHi/01dVKFUNLkjNNs9QLyUQF0uZjEt6j0OktPpob+Yt7mkwzb zLfiRvZvSlnuI1sdZyzJIcvToQA8L408r7q/JWjRqL/DQ1hNavZMJvo/wztxOyEw ssSYrUdMr6ZoKSma5/PDcBGifb/RQRHAJgBhNIkuZV9g+4c2kDYaMCmthUzyYgMo 4Fpruz/KYwL1npKHFZXRoKeuib8mFOJncF8t/3Gi9li3a9HUZU1LVRVgDQ1gLemk 7/IHD0BYuQ6iALawls6a =dPsE -----END PGP SIGNATURE-----
On Wed, Aug 20, 2014 at 04:07:59PM +0300, Alan Holt wrote:> I just install the newest version of Centos 7 and I am a bit disappointed > with new /etc/rc/local file > I found that it's not usable anymore. > > *[root at lab3 ~]# cat /etc/rc.local* > " THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES" > It is highly advisable to create own systemd services or udev rules > to run scripts during boot instead of using this file. > > Usually I was added my script to /etc/rc.local > > *[root at lab3 ~]# echo /usr/bin/bash /opt/ssh_tunnel.sh >> /etc/rc.local* > > And it was working perfect. > > What I should do in new Centos 7, please help.As the file says, it is highly advisable to create your own systemd service to replace what you put in /etc/rc.d/rc.local (the actual location, /etc/rc.local should be a symlink to /etc/rc.d/rc.local). /etc/rc.d/rc.local still works under CentOS7. You can continue to use it, however you'd be better served creating a systemd service unit. Look at the documentation here: http://www.freedesktop.org/software/systemd/man/systemd.service.html Depending on what you're doing, you could probably use a service with Type=oneshot. You might want to tell it to also add a Requires=network-online.target, since judging from the name of the script, it needs networking to be active. -- Jonathan Billings <billings at negate.org>
On Wed, Aug 20, 2014 at 04:07:59PM +0300, Alan Holt wrote:> Hello, > > I just install the newest version of Centos 7 and I am a bit disappointed > with new /etc/rc/local file > I found that it's not usable anymore.Short answer: http://forums.fedoraforum.org/showthread.php?t=300234 If you read through the thread, you'll see that you probably need to put the rc.local file under the /etc/rc.d directory. Longer answer: As the file says, if you plan to stick with Linux, eventually, you'll have to work with systemd. This list has already discussed it to death, but, much as many hate it, it's not going to go anywhere for awhile.> > *[root at lab3 ~]# cat /etc/rc.local* > " THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES" > It is highly advisable to create own systemd services or udev rules > to run scripts during boot instead of using this file.-- Scott Robbins PGP keyID EB3467D6 ( 1B48 077D 66F6 9DB0 FDC2 A409 FA54 EB34 67D6 ) gpg --keyserver pgp.mit.edu --recv-keys EB3467D6