how to use su with crontab inside script

  • Follow


I am the super user "root" I have all previleges.I can remove the
crontab when I used as
su -c user
crontab -r
in the command prompt.
But when I tried to do the same in inside the script it shows the $
symbol alone exiting from the program.So how to remove the crontab
using commands inside the script?

0
Reply mathiyazhagang (4) 3/5/2007 2:55:16 PM

>>>>> "mathiyazhagang" == mathiyazhagang  <mathiyazhagang@gmail.com> writes:

mathiyazhagang> I am the super user "root" I have all previleges.I can remove the
mathiyazhagang> crontab when I used as
mathiyazhagang> su -c user
mathiyazhagang> crontab -r
mathiyazhagang> in the command prompt.
mathiyazhagang> But when I tried to do the same in inside the script it shows the $
mathiyazhagang> symbol alone exiting from the program.So how to remove the crontab
mathiyazhagang> using commands inside the script?

If you're the super user, you can just use the "user" option on crontab:

crontab -u user -r

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
Posted via a free Usenet account from http://www.teranews.com

0
Reply merlyn1 (1433) 3/5/2007 3:23:18 PM


On 5 Mar 2007 06:55:16 -0800, mathiyazhagang@gmail.com 
  <mathiyazhagang@gmail.com> wrote:
>
>
> I am the super user "root" I have all previleges.I can remove the
> crontab when I used as
> su -c user
> crontab -r
> in the command prompt.
> But when I tried to do the same in inside the script it shows the $
> symbol alone exiting from the program.So how to remove the crontab
> using commands inside the script?
>
The next argument after -c should be a command.  Try
su user -c "crontab -r"
or
crontab -u user -r


-- 
Hartley's First Law:
	You can lead a horse to water, but if you can get him to float
	on his back, you've got something.
0
Reply marcumbill (1012) 3/5/2007 4:39:16 PM

2 Replies
17 Views

(page loaded in 0.075 seconds)

5/23/2013 5:28:28 PM


Reply: