HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Log the process
Operating System - HP-UX
1834149
Members
2244
Online
110064
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
11-28-2005 10:15 PM
11-28-2005 10:15 PM
Log the process
I run the below command on the unix shell,
mv /tmp/abc /tmp1/ >> /tmp/abc.log
but no matter the process is success or not , it still no message write to the log ( eg. no such file ) , if I want to log what file has been moved , what can I do ? thx
mv /tmp/abc /tmp1/ >> /tmp/abc.log
but no matter the process is success or not , it still no message write to the log ( eg. no such file ) , if I want to log what file has been moved , what can I do ? thx
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2005 10:26 PM
11-28-2005 10:26 PM
Re: Log the process
You need to write your own shell script with log messages based on success or failure from $? Or, you can use redirect mv /tmp/abc /tmp1/ 2>&1 /tmp/abc.log
-Arun
-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2005 10:30 PM
11-28-2005 10:30 PM
Re: Log the process
>> is saying that it will log only STDOUT messages to /tmp/abc.log (appending).
If you want to capture standard output and as well as standerr messages then,
# mv /tmp/han-muthu /tmp1/ 1>>/tmp/abc.log 2>&1
which adds error messages also.
now /tmp/han-muthu file will not be there and it will make entry in that file.
To check operation success then,
echo ${?}
if 0 then success else it is failure. see relative man page with RETURN values part.
hth.
If you want to capture standard output and as well as standerr messages then,
# mv /tmp/han-muthu /tmp1/ 1>>/tmp/abc.log 2>&1
which adds error messages also.
now /tmp/han-muthu file will not be there and it will make entry in that file.
To check operation success then,
echo ${?}
if 0 then success else it is failure. see relative man page with RETURN values part.
hth.
Easy to suggest when don't know about the problem!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2005 10:37 PM
11-28-2005 10:37 PM
Re: Log the process
Hi,
while redirecting standard output / error the convention is to use
1>> for redirecting the standard output
2>> for redirecting the standard error
in your case if you want to log the error msg ( no such file) to the abc.log , we have to use
#mv /tmp/abc /tmp/1 2>> /tmp/abc.log
This will redirect the error ( which is displayed in console ) to the abc.log
The same time if you want redirect the output(otherthan error messages) like output of #ls command etc, we have to use
#ls 1>> /tmp/abc.log
in this case the output will be redirected to abc.log instead of getting displayed on the console.
With Regards,
Siva.
while redirecting standard output / error the convention is to use
1>> for redirecting the standard output
2>> for redirecting the standard error
in your case if you want to log the error msg ( no such file) to the abc.log , we have to use
#mv /tmp/abc /tmp/1 2>> /tmp/abc.log
This will redirect the error ( which is displayed in console ) to the abc.log
The same time if you want redirect the output(otherthan error messages) like output of #ls command etc, we have to use
#ls 1>> /tmp/abc.log
in this case the output will be redirected to abc.log instead of getting displayed on the console.
With Regards,
Siva.
Nothing is Impossible !
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP