- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- cron task
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
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
06-17-2005 02:11 AM
06-17-2005 02:11 AM
cron task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2005 02:18 AM
06-17-2005 02:18 AM
Re: cron task
xxxx ssjkjj skjjw;jw l;wk;kw \
sssjsj
That counts as one line. Also it is a bad practice to do crontab -e. It is better to
do crontab -l "user_name" > /tmp/somefile.
Modify /tmp/somefile.
crontab /tmp/somefile
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2005 02:18 AM
06-17-2005 02:18 AM
Re: cron task
If you need complicated scripting, put it in a separate script and call that.
If you just need to run a few commands and capture their output together use something like:
* * * * * ( command1 ; command2 ; command3 ) > logfile 2>&1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2005 02:30 AM
06-17-2005 02:30 AM
Re: cron task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2005 07:40 PM
06-17-2005 07:40 PM
Re: cron task
* * * * * /usr/bin/mailx -s test
is the same as
* * * * * echo "hello world" | /usr/bin/mailx -s test
So all text up to % in the command field is executed by the shell. The rest (after %) is provided as standard input for the command that appears before %.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2005 03:32 PM
06-18-2005 03:32 PM
Re: cron task
(to turn off wrapmargin, type the command :set wm=0
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2005 03:17 PM
06-19-2005 03:17 PM
Re: cron task
I have just tried. It is taking as one line only. I have typed without giving "enter" in between. I don't know is it because WM mentioned by Bill is set by default in my terminal as I am using reflection to connect to all the servers. So you need not to use different charecters to make it one line.
regards,
Jino
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2005 01:34 AM
06-20-2005 01:34 AM
Re: cron task
:set
autoindent autowrite ignorecase redraw report=1 shell=/sbin/sh showmode term=70092 nowrapscan wrapmargin=2
In my case, the automatic line split occurs when typing a new line and I reach the last 2 columns. An existing long line is not split automatically by vi. Set wrapmargin (or wm, the abbreviation) to zero and you'll get long lines by default. To make this permanent for your shell, edit .exrc in your home directory to add this line at the top:
set nowrapsearch ignorecase autoindent autowrite wrapmargin=0 sh=/usr/bin/sh report=1 showmode
Now if you don't have a .exrc file, just create it with this above line. If you already have one, just adjust the existing set line similar to above. I have several useful options in the above example. The () parens show the abbreviation you can use for the same setting. All of these can be set inside vi for the current session using :set
nowrapsearch (nows) stops vi from silently wrapping around the file when searching.
ignorecase (ic) makes searches case-insensitive
autoindent (ai) will automatically follow your indentation. Each new line starts directly below the previous line including and leading spaces. To back up or get back to the beginning of the line, type CTRL-d to backup 1 tab distance.
autowrite (aw) will post the current changes to the original file when you escape to a shell (ie, :!sh)
wrapmargin=0 (wm=0) says to not split new lines when they are within XX columns of the end of the margin. NOTE: wm=72 means split lines starting 72 columns BEFORE the right edge, not column 72. This setting allows the wm setting to vary based on the width of the terminal.
sh=/usr/bin/sh sets the shell to use. If not set, the SHELL variable is used.
report=1 sets the number of lines that must be changed by a command before a report line is displayed (ie, 12 lines deleted) at the bottom left of the screen.
showmode (smd) sets the tag message at the bottom right of your vi screen to show REPLACE or INPUT when vi is not in the command mode.
All these (and many more) settings are defined in the man page for ex (not vi). Vi is actually several editors in one. All : commands (like :!sh or :%d or :set) are run byy the ex editor.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2005 01:56 AM
06-20-2005 01:56 AM
Re: cron task
Example:
#defrag filesystems
0 22 * * 4 /usr/local/bin/fsadm.defrag >/dev/null 2>&1
# cat /usr/local/bin/fsadm.defrag
#!/bin/sh
# defrag all mounted file systems
LOG=/tmp/fsadm.defrag.log
if [ -f $LOG ]
then
mv $LOG $LOG.old
fi
cat /dev/null > $LOG
for i in `mount -l | grep -v stand |awk '{print $1}'`
do
echo "defraging " $i >> $LOG
fsadm -F vxfs -d -D -e -E $i >> $LOG
done
It would be ugly to put that all on a single command line...
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2005 02:18 AM
06-20-2005 02:18 AM
Re: cron task
>> for i in `mount -l | grep -v stand |awk '{print $1}'`
mount -l shows local filesystems but will return vxfs (desired), hfs (not applicable) and cdfs (not applicable). If you change the command to something like this, it will work for all systems:
for i in $(bdf -t vxfs | grep -v %used |awk '{print $1}')
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2005 03:13 AM
06-20-2005 03:13 AM
Re: cron task
# bdf -t vxfs | grep -v %used |awk '{print $1}'
/dev/vg00/lvol3
/dev/vg00/lvol8
/dev/vg48/lvsw
/dev/vg48/lvoraclesw
20971520
/dev/vg48/lvmiscsw
/dev/vg48/lvibmsw
/dev/vg48/lvhpsw
/dev/vg48/lvemcsw
/dev/vg46/lvol1
/dev/vg46/lvol2
/dev/vg00/lvol9
/dev/vg00/lvol7
/dev/vg47/lvol1
/dev/vg00/lvol6
/dev/vg14/lvol2
/dev/vg14/lvol5
/dev/vg14/lvol11
/dev/vg14/lvol1
/dev/vg14/lvol6
/dev/vg14/lvol3
/dev/vg14/lvol4
/dev/vg14/lvol10
/dev/vg00/lvol5
/dev/vg47/lvol2
/dev/vg00/lvol4
/dev/vg14/lvol7
Maybe use the bdfmegs script?
# bdfmegs vxfs | grep -v File |awk '{print $1}'
/dev/vg00/lvol3
/dev/vg00/lvol1
/dev/vg00/lvol8
/dev/vg48/lvsw
/dev/vg48/lvoraclesw
/dev/vg48/lvmiscsw
/dev/vg48/lvibmsw
/dev/vg48/lvhpsw
/dev/vg48/lvemcsw
/dev/vg46/lvol1
/dev/vg46/lvol2
/dev/vg00/lvol9
/dev/vg00/lvol7
/dev/vg47/lvol1
/dev/vg00/lvol6
/dev/vg14/lvol2
/dev/vg14/lvol5
/dev/vg14/lvol11
/dev/vg14/lvol1
/dev/vg14/lvol6
/dev/vg14/lvol3
/dev/vg14/lvol4
/dev/vg14/lvol10
/dev/vg00/lvol5
/dev/vg47/lvol2
/dev/vg00/lvol4
/dev/vg14/lvol7
Rgds...Geoff