Issues related to applications and software problems and general support
- Posts: 51
- Joined: 2012/07/06 23:57:24
i need to run several command at bootup. according to some forums, the best place to put them is in a cron:
Code: Select all
@reboot ( iptables -I INPUT 1 -p tcp --dport 10000 -j ACCEPT ; mkdir /var/lock/bash/ ; mount --bind /home /var/www ; )
i see that the commands are being acknowledged in `/var/log/cron` but they dont seem to be doing anything. i have to go in and manually do them from root after a reboot.
- Forum Moderator
- Posts: 30650
- Joined: 2009/09/24 10:40:56
- Location: Brighton, UK
There are alternate and preferred ways of doing those things. On CentOS 8 the default firewall is firewalld and you can add persistent rules to that using the firewall-cmd comand. Many of us think that firewalld is a huge bloated pig that has no place on a a server and prefer to use either nftables directly (which is the iptables replacement in CentOS 8) or use the iptables -> nftables wrapper which allows you to add rules using the iptables command that are then translated to nftables internally.
If you choose to use the iptables wrapper then it uses the same file in CentOS 8 as it did in CentOS 7 and you can add persistent rules to the /etc/sysconfig/iptables file, in the same format that you'd use to run the iptables command but minus the 'iptables ' bit of it on the front.
You can bind mount things directly from /etc/fstab, no need to run a separate mount command to do so.