- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Korn Script.
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
10-31-2001 03:05 PM
10-31-2001 03:05 PM
Korn Script.
And when it starts to loop I get a running out of swap space message. I finally kill the process and things are back to normal. So what am I doing wrong here?
The goal is to untar all files from a directory and have them output the tar files into a final directory, and if the dir does not exsist then create the dir directory.
--------Start of Scripts----------------------
tarpath=/home/s1perf
dumppath=$tarpath/interim
datapath=/opt/best1/local/collect/data
cd $dumppath
chown best1adm:support $dumppath/*
ls -1 *-*tar > $tarpath/babytar
cat $tarpath/babytar | sort | while read server_tarfile ; do
print;print;print
if [[ -f $server_tarfile ]] ; then
finalpath="$datapath/$(print $server_tarfile | cut -f 2 -d '.')_mn"
chown best1adm:support *
cd $finalpath
yes| tar xvf $dumppath/$server_tarfile
chown best1adm:support *
chmod 777 *
fi
done
if [[ -d $datapath ]] ; then
mkdir -p $datapath
chown best1adm:support $datapath
chmod 777 best1:support $datapath
fi
rm -r $dumppath/*
----------End of Script-----------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2001 03:09 PM
10-31-2001 03:09 PM
Re: Korn Script.
Try running it so;-
ksh -x <scriptname>
and watch where it loops.
HTH
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2001 03:13 PM
10-31-2001 03:13 PM
Re: Korn Script.
Also when using unix commands in a script always be pedantic in the path.
ie not chown but /usr/bin/chown or /sbin/chown
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2001 07:03 PM
10-31-2001 07:03 PM
Re: Korn Script.
Some general suggestions -
1. always delimint your variables in curly braces. when you say $dumppath/*, what you really mean is ${dumppath}/*.
2. specify the command interpreter to be used on the first line of your script like so:
#! /usr/bin/ksh
I've seen scripts without this behave very strangely because they were involed from csh.
3. just add a
set -x to your script and run - thst shoudl give you an indication of what is going wrong.
good luck.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2001 07:48 AM
11-01-2001 07:48 AM
Re: Korn Script.
for the trouble shooting part, you may just add the statements
set -x
set -v
to your script.
Then everything will be shown before and after substitution.
HTH,
Wodisch