- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Regarding crontab
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 09:41 PM
08-15-2006 09:41 PM
For changing the crontab for fcc unix user id i am going to do the below steps
login as fcc unix user id
$ crontab -l > tempfile
$ cat addfile >> tempfile
$ crontab tempfile
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 09:49 PM
08-15-2006 09:49 PM
Re: Regarding crontab
With user "root":
# crontab -l fcc > /tmp/crontab.fcc.txt
# crontab -e root
add crontab.fcc.txt (:r /tmp/crontab.fcc.txt)
# crontab -l root
if ok,
# crontab -r fcc
rgs
ran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 09:51 PM
08-15-2006 09:51 PM
Re: Regarding crontab
# crontab -l fcc > /tmp/crontab.fcc.txt
# cat /tmp/crontab.fcc.txt >> /var/spool/cron/crontabs/root
ran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 09:55 PM
08-15-2006 09:55 PM
Re: Regarding crontab
how about :
As root:
cat addfile >> /var/spool/cron/crontabs/fcc
If you use crontab tempfile as root it will change the root crontab file!
Alternatively you can run your script with:
su fcc -c yourscriptname
But ensure you specify all paths and variables required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 11:35 PM
08-15-2006 11:35 PM
Re: Regarding crontab
crontab -l > tempfile
cat addfile >> tempfile
crontab tempfile
In my main script run_crn_update.sh
echo "cron update is started"
su scc -c "/top1/frien/new/updatecron_fcc.sh"
echo "cron update is completed"
I hope after execute the updatecron_fcc.sh script successfully only the next line echo will get executed. I dont know how it works. Do i need to run as nohup?
Hope this one will work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 11:56 PM
08-15-2006 11:56 PM
Re: Regarding crontab
I would amend to:
(Please note the addfile path to be added)
>cat updatecron_fcc.sh
#!/usr/bin/sh
/usr/bin/crontab -l > /tmp/tempfile
#Please add your path before the addfile
/usr/bin/cat addfile >> /tmp/tempfile
/usr/bin/crontab /tmp/tempfile
exit
And, should it be scc or fcc root su's to ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 01:20 AM
08-16-2006 01:20 AM
Re: Regarding crontab
crontab -l fcc > /tmp/beforecronupd
echo "cron update is started"
su fcc -c "/top1/frien/new/updatecron_fcc.sh"
echo "cron update is completed"
crontab -l fcc > /tmp/aftercronupd
$(diff /tmp/beforecronupd /tmp/aftercronupd >/dev/null 2>&1) && echo "crontab did not change" || echo "crontab changed"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 03:44 AM
08-16-2006 03:44 AM
Re: Regarding crontab
step will it work.
crontab -l fcc > /tmp/tempfile
cat modifile >> /tmp/tempfile
crontab -l fcc tempfile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 04:16 AM
08-16-2006 04:16 AM
SolutionYou'd need to either write directly to /var/spool/cron/crontabs/fcc (BAD)
or do an:
su fcc -c "crontab /tmp/tempfile"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 04:59 AM
08-16-2006 04:59 AM
Re: Regarding crontab
I know linux crontab has a -f option to read from a file. crontab tempfile is not going to work.
If you are very careful, you can cat the addfile >>
The actual crontab file is in /var/spool/cron
Make a backup before you proceed.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 05:40 AM
08-16-2006 05:40 AM
Re: Regarding crontab
'crontab file' should install file as the crontab.
# crontab -l fifejj > /tmp/mycron
# cat /tmp/mycron
* * * * * /bin/true
# echo "* * * * * /bin/false" >> /tmp/mycron
# su fifejj -c "crontab /tmp/mycron"
warning: commands will be executed using /usr/bin/sh
# crontab -l fifejj
* * * * * /bin/true
* * * * * /bin/false
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 12:57 AM
08-21-2006 12:57 AM
Re: Regarding crontab
if i do a crontab -r will it stop the cron under my unix user id? Is it a way to stop the cron?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 03:04 AM
08-21-2006 03:04 AM
Re: Regarding crontab
Note that the when you do a crontab -r, the crontab file will be removed completely, so if you'll need it again be sure to save it off first (eg. crontab -l user > /home/user/my.crontab)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 03:22 AM
08-21-2006 03:22 AM
Re: Regarding crontab
Another way to effectively prevent cron from running as a particular user is to comment out every line of that user's crontab.
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2006 12:38 AM
08-23-2006 12:38 AM
Re: Regarding crontab
crontab -l fcc > /tmp/tempfile
So i changed this command to the below one
su fcc -c "crontab -l >/tmp/fcccron_old"
It seems to be working but i got some doubts
when i checked the /var/crontab/cron/fcc directory.
Before executing the "su fcc -c..." command the permission
happens to be below
-> cd /var/spool/cron/crontabs
-> ll
total 30
-r-------- 1 adm adm 535 Jan 4 2006 adm
-r-------- 1 informix informix 263 Jan 4 2006 informix
-r-------- 1 root fcc 19 Sep 15 2003 myd
-r-------- 1 root sys 1606 Apr 25 11:11 root
-r-------- 1 fcc fcc 9109 Jan 4 2006 fcc
-r-------- 1 root amotng 219 Oct 25 2005 uam40
I checked the fcc file under crontab directory a day after the command was run . I did see the permission of fcc file under /var/spool/cron/crontab directory. The permissions,owner and group is changed. I dontknow whether someone had changed manually the permissions and owner of fcc file or the command had changed it. dont know whether the fcc cron will run if the permission and owner group are like this.
ll
total 32
-r-------- 1 adm adm 535 Jan 4 2006 adm
-r-------- 1 informix informix 263 Jan 4 2006 informix
-r-------- 1 root fcc 19 Sep 15 2003 myd
-r-------- 1 root sys 1606 Apr 25 11:11 root
-rwxrwxrwx 1 fcc fcc 9228 Aug 23 02:42 fcc
-r-------- 1 root amotng 219 Oct 25 2005 uam40
The file permission ,owner are changed. Dont know how it got changed
rwxrwxrwx 1 fcc fcc 9228 Aug 23 02:42 fcc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2006 01:21 AM
08-23-2006 01:21 AM
Re: Regarding crontab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2006 04:06 AM
08-23-2006 04:06 AM
Re: Regarding crontab
su fcc -c "crontab /tmp/fccmodcron"
I want to know if we do this whether the permissions,owner and group will change in
/var/spool/cron/crontabs/fcc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2006 07:07 PM
09-06-2006 07:07 PM