Operating System - HP-UX
1827802 Members
2341 Online
109969 Solutions
New Discussion

Cronjob is not run at single user mode.

 
honor
Occasional Contributor

Cronjob is not run at single user mode.

How do I enable crontab daemon at singer user mode?
11 REPLIES 11
Bill Hassell
Honored Contributor

Re: Cronjob is not run at single user mode.

Single user mode will not run cron. You can start cron if you want but in single user mode, nothing is working -- no networking, no mount points except / and /stand, no additional volume groups. Why would you leave your computer in single user mode for any length of time?


Bill Hassell, sysadmin
James R. Ferguson
Acclaimed Contributor

Re: Cronjob is not run at single user mode.

Hi:

You don't. At single-user mode, only '/' is mounted. The 'cron' daemon expects '/var/spool/cron/crontabs' to be present (when '/var' is mounted).

Too, the 'cron' daemon is started at run-level-2 which can be deduced by doing:

# ls -l /sbin/rc?.d/*cron*
lrwxr-xr-x 1 root root 17 Mar 3 14:20 /sbin/rc1.d/K270cron -> /sbin/init.d/cron
lrwxr-xr-x 1 root root 17 Mar 3 14:20 /sbin/rc2.d/S730cron -> /sbin/init.d/cron

Regards!

...JRF...

Patrick Wallek
Honored Contributor

Re: Cronjob is not run at single user mode.

Why would you want to?

Single-user mode is for maintenance ONLY.
honor
Occasional Contributor

Re: Cronjob is not run at single user mode.

If we bring machine for multi mode to single mode /var /usr /opt and / are still mounting.

# who -r
. run-level S Aug 21 17:16 S 1 3

# bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 1572864 324488 1238632 21% /
/dev/vg00/lvol8 5144576 1809536 3309048 35% /var
/dev/vg00/lvol7 3276800 2643864 628072 81% /usr
/dev/vg00/lvol5 7569408 3915224 3625640 52% /opt
James R. Ferguson
Acclaimed Contributor

Re: Cronjob is not run at single user mode.

Hi (again):

> If we bring machine for multi mode to single mode /var /usr /opt and / are still mounting.

...and HOW did you do this? You din *not* boot into single-user mode, rather you did 'init S', no doubt. Look at the manpages for 'init' to see"

/* begin quote */

Transitioning into run level S from a higher run level does not terminate other system activity and does not result in a "single-user state"; this operation should not be done.

/* end quote */

Rebooot; interact with the IPL and issue 'hpux -is'. *THEN* you will be in single-user mode where nothing but '/' is mounted.

Now, reread, my original post, above.

Regards!

...JRF...
Torsten.
Acclaimed Contributor

Re: Cronjob is not run at single user mode.

Could you explain what you really want to do?

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
honor
Occasional Contributor

Re: Cronjob is not run at single user mode.

We do some maintenance and do not want users to login to the machines to run anything and also do not want to power down the machines.

We think the best way for this request is schedule a cronjobs to bring machine to single mode and back to multi mode when maintenance is done.

Pete Randall
Outstanding Contributor

Re: Cronjob is not run at single user mode.

You might want to try "init 2", where the file systems should be mounted, most system processes have been started, yet the system is not in multi-user mode (no CDE). This might accomplish what you wish.


Pete

Pete
Tim Nelson
Honored Contributor

Re: Cronjob is not run at single user mode.

That certainly is an interesting way to do things.

I would probably do it a little differently.

-stop services to keep users off system.
-do maintenance
-re-start services
(do all of this in run-level 3)
James R. Ferguson
Acclaimed Contributor

Re: Cronjob is not run at single user mode.

Hi (again):

> We do some maintenance and do not want users to login to the machines to run anything and also do not want to power down the machines

You haven't defined "maintenance" tasks. That said, you might want to look into using the 'NOLOGIN' attribute (or others) of the '/etc/default/security' file to prevent logins during your window.

http://docs.hp.com/en/B3921-60631/security.4.html

Regards!

...JRF...
Bill Hassell
Honored Contributor

Re: Cronjob is not run at single user mode.

Although it is different on other Unix boxes, init s NEVER brings the system into single user mode -- despite comments in the man page. (it used to do this about 15 years ago but not now) The init s command simply stops any processes that init owns (except those in inittab with the s flag. But init does not unmount filesystems nor does it get rid of processes it does not own.

There is only one way to ch angeto single user mode: reboot, interrupt the boot process and run the hpux -ix command. No disks will be mounted (except / and /stand), no networking, no applications.

As far as maintenance, if all your users login with telnet, rlogin, ssh, etc, you can simply create the file: /etc/nologin and add the NOLOGIN=1 to the file: /etc/default/security -- like this:

echo "NOLOGIN=1" >> /etc/default/security
echo "Maintenance underway" > /etc/nologin

Now, no user can login except root. See the man page for security. To stop cron, use this command:

/sbin/init.d/cron stop

You may need to look at /etc/inittab for other automated processes as well as inetd for network services like ftp.


Bill Hassell, sysadmin