HPUX - Sendmail and delete file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting HPUX - Sendmail and delete file
# 1  
Old 01-27-2009
HPUX - Sendmail and delete file

Hi,

I am logging the output of bdf command to a file called /tmp/bdfoutput in HPUX server. I want a mail to be sent at 11.55 PM everyday and then the file needs to be rolled over as /tmp/bdfoutput.1 , /tmp/bdfoutput.2 ....etc and the new file has to be created.

Please assist in getting the script.
# 2  
Old 01-27-2009
create a cron script that goes off at 23:55 every day that does the following:

1. get the highest numbered /tmp/bdfoutput.# file. I'm sure there are plenty of ways here's one off the top of my head:

Code:
FNUM=$(ls -1 /tmp/bdfoutput.* | sort -t. -k2nr | head -n 1 | cut -f2 -d. )

Note: in the 'ls -1' command that is "one" not "ell" as the option.

Should leave you with just the number in $FNUM

2. use mailx to send out /tmp/bdfoutput as the body of the mail message
to your recipient(s).

and then

Code:
((FNUM+=1))
mv /tmp/bdfoutput /tmp/bdfoutput.${FNUM}

Note2: If you write this as a cron script, make sure to fully qualify the paths to non built-in commands,
and don't have any debugging output in your final version that cron will use.

Last edited by rwuerth; 01-27-2009 at 07:14 PM.. Reason: added 'Note' and 'Note2'
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Compile sendmail on hpux

The sendmail on hp site is too old,and still support the bugged ssl3(poodle) even if enable tlsv1. So i decide to compile sendmail by myself i use this site.config.m4 define(`confCClibsmi', `gcc -fPIC') define(`confCC',`/usr/local/bin/gcc -fPIC') define(`confOPTIMIZE', ` -O3')... (0 Replies)
Discussion started by: Linusolaradm1
0 Replies

2. HP-UX

How to list file size on HPUX?

I used to use ls -l cut to detrmine file size, and google searches didn't come up with anything else but 'stat' which doesn't appear on HPUX. I discovered the humble 'wc -c' which does this job very neatly, and thought I would share it. (7 Replies)
Discussion started by: tbochan
7 Replies

3. HP-UX

File descriptor directory in HPUX

Hi, In solaris I remember this direcotry structure /proc/<pid>/fd in this directory ls -l | wc -l would give me the number of file descriptor for that process. Where can I find the similar in HPUX (11 Replies)
Discussion started by: mohtashims
11 Replies

4. HP-UX

pwage-hpux-T for Trusted HPUX servers

I'm sharing this in case anybody needs it. Modified from the original solaris pwage script. This modified hpux script will check /etc/password file on hpux trusted systems search /tcb and grep the required u_succhg field. Calculate days to expiry and notify users via email. original solaris... (2 Replies)
Discussion started by: sparcguy
2 Replies

5. UNIX for Dummies Questions & Answers

How to get timestamp of a file in HPUX

Hi All, Am trying to get a command which gives the "date + time" that a file was edited. I cant use "ls -l" because it fails to get me the "time stamp" of files that were edited more than 6 months ago...commands like "stat" "ctime" etc aren't available on my server and I can't install them... (12 Replies)
Discussion started by: n_rajitr
12 Replies

6. UNIX for Dummies Questions & Answers

I/O performance in HPUX file systems

Hi guys, what is the relation between I/O performance and file systems. I have a file systems called /dcs/data01 which is having 4Tb size. According our application we can split the file system like dcs/data01 -> 1Tb dcs/data02 -> 1Tb dcs/data03 -> 1Tb dcs/data04 -> 1Tb do you... (4 Replies)
Discussion started by: Davinzy
4 Replies

7. HP-UX

HPUx sendmail Question

why is that I need to go to /usr/sbin> in order to run send mail how can I run sendmail where ever folder I'm in... e.g. like /stuff/games/sendmail ksh: sendmail: not found (7 Replies)
Discussion started by: makaveli
7 Replies

8. Shell Programming and Scripting

Need Script to Use CPUs on a HPUX server to simulate Workload Manager on HPUX.

I am running HPUX and using WLM (workload manager). I want to write a script to fork CPUs to basically take CPUs from other servers to show that the communication is working and CPU licensing is working. Basically, I want to build a script that will use up CPU on a server. Any ideas? (2 Replies)
Discussion started by: cpolikowsky
2 Replies

9. Shell Programming and Scripting

.profile file error on HPUX 11.11

Hi, I am working on HPUX 11.11i and 11.10 boxes. My default shell is ksh. I have the following entry in my profile file HOSTNAME=`uname -n` Every time I login to the server, this is the error I get: ${HOME:-.}/.profile: syntax error: `)' unexpected The line number shown... (1 Reply)
Discussion started by: Yomaanmean
1 Replies

10. Programming

Document file reader for HPUX

Hi All, has anyone found any document file reader for HPUX? I have been finding myself in trouble without having one.. if there is nothing that exist, I am thinking of developing one of my own through C, Not being a professional C programmer, I need to have a good start.. can someone please throw... (0 Replies)
Discussion started by: sskb
0 Replies
Login or Register to Ask a Question