- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Write to a log file in RHAS Linux 3.0
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
Discussions
Discussions
Forums
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
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
тАО07-11-2007 07:01 AM
тАО07-11-2007 07:01 AM
I have a cron job that goes out and modify the permission (chmod 666) on a text file once day. I would like to know how I can capture the changes in a log file? Or logs the event during as part of the cron job via e-mail.
What would you Linux expert do in my case??
Thank you in advance.
Jorge C.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-11-2007 07:28 AM
тАО07-11-2007 07:28 AM
SolutionOne way is to redirect the output of the cron job.
jobname | mail -s "my cron job" yourname@yourdoiman.com
That will send the output of the job to the email address of your choice.
Or you could jobname >> logfile sending all output of the cron job to a logfile name of your choice.
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
тАО07-11-2007 07:29 AM
тАО07-11-2007 07:29 AM
Re: Write to a log file in RHAS Linux 3.0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-11-2007 07:48 AM
тАО07-11-2007 07:48 AM
Re: Write to a log file in RHAS Linux 3.0
Heironimus - How would I began to write this script that will displayed the output to a log file? Do you have examples of these log files?
Thanks,
Jorge
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-11-2007 09:00 AM
тАО07-11-2007 09:00 AM
Re: Write to a log file in RHAS Linux 3.0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-11-2007 09:25 AM
тАО07-11-2007 09:25 AM
Re: Write to a log file in RHAS Linux 3.0
Use the MAILTO option in crontab.
Redirect the output to a logfile, for example
5 1 * * * job.sh > /tmp/job.log 2>&1
This will redirect the standard output and error to the job.log file.
Just remember that chmod command does not provides any output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-11-2007 11:18 AM
тАО07-11-2007 11:18 AM
Re: Write to a log file in RHAS Linux 3.0
I checked and triple checked the syntax and it was correct.
Any ideas?
Thank you.
Jorge
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-11-2007 01:01 PM
тАО07-11-2007 01:01 PM
Re: Write to a log file in RHAS Linux 3.0
chmod 644 test786;ll test786 >test786.out
cat test786.out
-rw-r--r-- 1 root root 384 Jun 4 15:52 test786
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-11-2007 02:37 PM
тАО07-11-2007 02:37 PM
Re: Write to a log file in RHAS Linux 3.0
If chmod command does not create output, than how did you managed to create an output with your test??
Am i missing something here?? I just need to know if my script ran successfully.
Thanks,
Jorge
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-11-2007 09:11 PM
тАО07-11-2007 09:11 PM
Re: Write to a log file in RHAS Linux 3.0
you can check this using one of two ways:
1) ls -l your_file
you should see proper permission
2) echo $?
you should see 0 - exit code of chown