Fedora This forum is for the discussion of the Fedora Project. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
07-24-2006, 05:54 PM
|
#1
|
Member
Registered: Apr 2006
Posts: 38
Rep:
|
crontab execute consecutively
Hi,
I want to execute the my jobs consecutively, is that possible with crontab. After one job is finished the next starts.....and so on.
thanks
|
|
|
07-24-2006, 06:06 PM
|
#2
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
Sure, just create an entry with a command like:
Code:
15 1 * * * command1 && command2 && command3 && command4
|
|
|
07-24-2006, 06:19 PM
|
#3
|
Member
Registered: Apr 2006
Posts: 38
Original Poster
Rep:
|
hi matir,
thanks for your response,
does it mean, that I assign a starttime and then connect each of my tasks with &&......that's it
does it have to be in one line or can I make newlines too.....
Code:
15 1 * * * command1 &&
command2 &&
command3 &&
command4
or something like that.....due to keeping track... 
|
|
|
07-24-2006, 06:23 PM
|
#4
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
Cron jobs should each appear on a single line. If you need a large number of commands, I encourage placing them in a shell script and then executing this shell script rather than placing all the commands within the cron job.
|
|
|
07-24-2006, 07:20 PM
|
#5
|
Member
Registered: Apr 2006
Posts: 38
Original Poster
Rep:
|
ok, thanks
Last edited by SofNine; 07-25-2006 at 06:59 PM.
|
|
|
07-25-2006, 07:00 PM
|
#6
|
Member
Registered: Apr 2006
Posts: 38
Original Poster
Rep:
|
hi,
is ist possible to execute one command in the script with root and the others with the normal user?
my script is invoked usually as normal user, but I want one command to be executed as root....
|
|
|
07-25-2006, 07:34 PM
|
#7
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
You can use sudo to accomplish that.
|
|
|
07-26-2006, 01:03 AM
|
#8
|
Member
Registered: Apr 2006
Posts: 38
Original Poster
Rep:
|
hi,
I have tried it with sudo. They tell you that you have to make an entry in /etc/sudoer, which I have done. I have a script which executes several commands, one of them needs root privileges.
And I want the script to execute this command without asking for the password, but with the following it still asks for the password.
the entry in my sudoer file looks like:
Code:
# User privilege specification
root ALL=(ALL) ALL
Hubert ALL=(ALL) NOPASSWD: /home/Hubert/database_update.sh
the database_update script:
Code:
#!/bin/sh
......
sudo rm -rf /usr/local/database
.......
thanks
|
|
|
07-26-2006, 09:22 AM
|
#9
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
The part after the NOPASSWD: has to be the command to be executed as root (in this case, "rm -rf /usr/local/database").
|
|
|
07-26-2006, 11:46 AM
|
#10
|
Member
Registered: Apr 2006
Posts: 38
Original Poster
Rep:
|
hello matir,
I have done what you told me, but I get still permission denied. Is there anything else?
thanks
|
|
|
07-26-2006, 11:50 AM
|
#11
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
You may need to specify a full path to rm in both sudoers and the command line itself (/bin/rm).
|
|
|
07-26-2006, 01:24 PM
|
#12
|
Member
Registered: Apr 2006
Posts: 38
Original Poster
Rep:
|
hi matir,
ok, I assume there is something wrong with my distribution, I get the following error:
Code:
>>> sudoers file: syntax error, line 22 <<<
sudo: parse error in /etc/sudoers near line 22
|
|
|
07-26-2006, 01:37 PM
|
#13
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
Please post the full contents of your current sudoers file.
|
|
|
07-26-2006, 03:23 PM
|
#14
|
Member
Registered: Apr 2006
Posts: 38
Original Poster
Rep:
|
hi,
sudoer file:
Code:
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# Host alias specification
# User alias specification
# Cmnd alias specification
# Defaults specification
Defaults env_reset
Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR \
LS_COLORS MAIL PS1 PS2 QTDIR USERNAME \
LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC \
LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS \
_XKB_CHARSET"
# Runas alias specification
# User privilege specification
root ALL=(ALL) ALL
Hubert ALL=(ALL) NOPASSWD: "/usr/bin/cvs -d :pserver:cvs@code.open-bio.org:/home/repository/bioperl checkout bioperl-live"
# Uncomment to allow people in group wheel to run all commands
# %wheel ALL=(ALL) ALL
# Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
# Samples
# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users localhost=/sbin/shutdown -h now
~
if I execute the cvs command on the command line it works just fine....of course as root
|
|
|
07-26-2006, 03:32 PM
|
#15
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
Try removing the quotes from around the command, similar to the format of other commands in the file.
|
|
|
All times are GMT -5. The time now is 08:10 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|