Link to home
Start Free TrialLog in
Avatar of iranmatrix
iranmatrixFlag for United Arab Emirates

asked on

cpanel command execute

Hi,

I have a question about my web server.
I am using cPanel and I need to execute a command before cpanel service start up.
Since cpanel key will executed by system itself, I need to know how can I execute my command before system try to execute cPanel start command.

I have tried putting my command in  /etc/inittab but it get executed AFTER cPanel which will make it useless.

Any suggestion people ?

Thank you,
Avatar of ai_ja_nai
ai_ja_nai
Flag of Italy image

if cPanel is executed in /etc/rc1.d/, you should see to which letter and number it belongs. A lower letter will make the service start earlier.
Can you list the content of that folder?
Avatar of iranmatrix

ASKER

Hi,
here is my /etc/rc1.d

root@server [/etc/rc1.d]# ls
./                            K30exim@             K88auditd@
../                           K35winbind@          K88pcscd@
K01smartd@                    K36mysql@            K88syslog@
K02avahi-daemon@              K50netconsole@       K88wpa_supplicant@
K02avahi-dnsconfd@            K50snmpd@            K89dund@
K02dhcdbd@                    K50snmptrapd@        K89hidd@
K02haldaemon@                 K55bandmin@          K89netplugd@
K02NetworkManager@            K56acpid@            K89pand@
K02NetworkManagerDispatcher@  K60crond@            K89rdisc@
K02oddjobd@                   K69rpcsvcgssd@       K90bluetooth@
K03yum-updatesd@              K72autofs@           K90network@
K05anacron@                   K74ipmi@             K91filelimits@
K05conman@                    K74lm_sensors@       K91ipaliases@
K05portsentry@                K75netfs@            K92ip6tables@
K05saslauthd@                 K85courier-authlib@  K92iptables@
K10assp@                      K85mdmonitor@        K95firstboot@
K10cpanel@                    K85mdmpd@            K95kudzu@
K10psacct@                    K85messagebus@       K97sysstat@
K10securetmp@                 K85rpcgssd@          K99microcode_ctl@
K15httpd@                     K87irqbalance@       K99readahead_early@
K20nfs@                       K87mcstrans@         K99readahead_later@
K24irda@                      K87multipathd@       S02lvm2-monitor@
K25sshd@                      K87named@            S06cpuspeed@
K30courier-imap@              K87restorecond@      S99single@



please note that i want to use respawn action for this command in order to avoid killing it.
ok, put there your script and name it K9scriptname or less (K8,K7, etc) and it will be started before K10cpanel
Watchout that you should to add it with update-runlevels utility and then change the name to increase execution priority
but in this solution i cant use respawn to control if its killed and auto restart it.
is there any solution to use init instead of rc?
I beg your pardon, but you are making it a priority problem: you want to start it before another program starts up in the boot process. The runlevel control is the only way to make sure it goes before.

To check if it goes down, you can put a cron script set on every 5 mins to check from ps output if it's on
ASKER CERTIFIED SOLUTION
Avatar of iranmatrix
iranmatrix
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
fine, accept your own solution if you think it's the best :)