Different edit crontab at Solaris..?

Hi..
At linux
I can edit crontab with command
$crontab -e

BUT I don't know to edit crontab at Solaris
because I tried with command $crontab -e
I can't do that
Can you help me...?

Thanks for solution

regards,
srilinux

Why can't you do it?

You may not be authorized to use cron. Or; you may be editing your crontab with ed if your VISUAL environment variable is not set.

Cheers
ZB

Ok..
I have found crontab file at /var/spool/cron/crontabs
and I opened/edited with vi
#vi root
So Can you suggest for me if my script below wrong or mistakes
---------
#I want to ping every 15 minutes, everyday and responed only 5 time answer #for 1 IP (for example 10.0.0.62)
15 * * * * ping -s 10.0.0.62 56 5

You shouldn't edit the crontab directly like that.

From man crontab

           Note that all crontab jobs should be
           submitted using crontab; you should not  add  jobs  by
           just editing the crontab file because cron will not be
           aware of changes made this way.

Cheers
ZB

Continuing with man crontab:


SYNOPSIS
     crontab [ filename ]
     crontab [-elr] username

And


crontab Access Control
     Users: Access to crontab is allowed:

        o if the user's name appears in /etc/cron.d/cron.allow.

        o if /etc/cron.d/cron.allow does not exist and the user's
          name is not in /etc/cron.d/cron.deny.

     Users: Access to crontab is denied:

        o if /etc/cron.d/cron.allow exists and the user's name is
          not in it.

        o if /etc/cron.d/cron.allow does  not  exist  and  user's
          name is in /etc/cron.d/cron.deny.

        o if neither file exists.

     Note that the rules for allow and deny apply to root only if
     the allow/deny files exist.

     The allow/deny files consist of one user name per line.

So, have a look at the files located in /etc/cron.d

"crontab -e" should work...

And as zazzybob says, you should not edit crontabs by hand...

About your cron job, what do you want such a job for? Anyway its syntax is OK...

Regards.

Is it possible you dont have your EDITOR environment variable set and so when you issue the 'crontab -e' command on solaris you just get a ':' prompt?

If so try:

EDITOR=vi
export EDITOR
crontab -e

How to check whether the cron daemon is running?

How to to start, stop, know status of cron?

try ps -ef | grep cron ... or pgrep -l cron ... to show process, pid, etc.

As far as I know, it depends on your Solaris version. On Solaris 10 you should use svcs to check the status cron, like this:

$ svcs cron
STATE          STIME    FMRI
online         Jun_13   svc:/system/cron:default

.. also check the svcadm command to starting, stopping, enable-disable services.

I can edit used vi editor

But when I tried to use crontab -e at /etc/cron.d location
and proses wait...and then
I can't to do anything.

So until now I still used crontab at /usr/spool/cron/crontabs/root

what can I do in order to I can edit with crontab using -e (crontab -e)

you always edit the root's crontab when doing crontab -e as superuser, unless you specify another username as crontab -e foouser

yes I always edit with vi root (file this name is root), and I can't do anything with used crontab -e
(I see likes flash cursor).

I don't know why is different content include this file (between using vi root and crontab -e)
Because when I edited with OS Linux and using vi or crontab -e (content include this file is same), and no problem.

You can use:
# crontab -l > /tmp/root.cron
# vi /tmp/root.cron
---- make your changes
# crontab < /tmp/root.cron
then check your changes by
# crontab -l

Hope it helps !

:eek: this srilinux is not able to understand anything.
he is joking us. :smiley:
Srilinux just forget LINUX or UNIX. It is better. :eek:

We have some rules here and one of them is:

(3) Refrain from idle chatter that does not contribute to the knowledge base.

AaaaaaA seems interested only in violating that rule and at a rather rapid rate. After AaaaaaA joined, only an hour ago, he or she has made 3 useless posts. We can't risk allowing this to continue. Consequently, I have banned AaaaaaA.

Hi Shadow21
very nice your solution,
many thanks.
thanks also Perderabo about "Your Rule"
and thanks too for everybody have been help me for my troubles.

regards,
:slight_smile: srilinux

Hi,

I got same problem as srilinux.

I had experience on UNIX, but with Sun I tried on some servers but crontab -e have never worked.

one man suggested me to edit cron file at /var/spool/cron/crontabs/ , but after edited, we need to perform command $crontab filename to make it worked.

I also check /etc/cron.d/ , there is no cron.allow file, and also my user is not in cron.deny, but it still not work.

regards,
milo

From the man page:

Try:
EDITOR=/usr/bin/vi
export EDITOR

hi Perderabo,

i performed commands as you suggested but it returned
peri@MPSAP1-hcm {4} EDITOR=/usr/bin/vi
EDITOR=/usr/bin/vi: Command not found

i tried to setenv by
setenv EDITOR=/usr/bin/vi
setenv export=EDITOR

then output of env is as:
EDITOR=/usr/bin/vi=
export=EDITOR
i don't understand why there is "=" after EDITOR=/user/bin/vi in env

and output of crontab -e is:
peri@MPSAP1-hcm {5} crontab -e
sh: /usr/bin/vi=: not found
The crontab file was not changed.

i also put your two commands (with setenv before) into .cshrc but it had same result.

appreciate all your help.

i tried with bash, and it worked :slight_smile: (after take a look at http://www.unix.com/showthread.php?t=33379\)

peri@MPSAP1-hcm {13} bash
bash-2.03$ export EDITOR=vi
bash-2.03$ crontab -e

my current shell is csh.

thanks.

For csh try:
setenv EDITOR /usr/bin/vi