Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-11-2003, 01:45 PM
|
#1
|
Member
Registered: Jan 2003
Location: des moines, ia
Distribution: suse RH
Posts: 129
Rep:
|
echo "help me out" >> dest_file
This does not seem to work in RH 8.0
I have a script that runs in RH7.3 that I cannot get to run in 8.0
rm -f ~/daily_process
touch ~/daily_process
echo "**** Update virus file ****" >> ~/daily_process
<run script> >> ~/daily_process
echo "*** Scan file system ***" >> ~/daily_process
The script runs and directs output but the echo lines do not show up in my output file.
Any ideas?
j-me
|
|
|
08-11-2003, 02:09 PM
|
#2
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
If you comment out the part where the script is run do you still not see the echo lines? That doesn't look like the full script. Can you copy and paste the whole thing.
|
|
|
08-11-2003, 02:18 PM
|
#3
|
Member
Registered: Jan 2003
Location: des moines, ia
Distribution: suse RH
Posts: 129
Original Poster
Rep:
|
##!/bin/sh
rm -f ~/daily_process # delete previous day file
touch ~/daily_process # housekeeping to setup file
echo ">>> daily process /odin for `date`" >> ~/daily_process ; echo ""
echo '' >> ~/daily_process
echo '*** Update Virus file ' >> ~/daily_process
/usr/local/bin/vsupdate >> ~/daily_process # Update file that wscanall uses to scan for viruses
echo '' >> ~/daily_process
echo '*** Scan entire system for viruses ' >> ~/daily_process
/usr/local/bin/scanall >> ~/daily_process # Scan All filesystems for viruses
echo '' >> ~/daily_process
echo '*** Disk Statistics *** ' >> ~/daily_process
echo '' >> ~/daily_process
echo '*** disk space usage *** ' >> ~/daily_process
df -h >> ~/daily_process # disk space usage snapshot
echo '' >> ~/daily_process
echo '*** disk inode usage *** ' >> ~/daily_process
df -ih >> ~/daily_process # disk inode statistic snapshot
#tail -16 /opt/uagent/logs/uag.log >> ~/daily_process # most recent backup data (may have to a adjust if add more filesystems)
# clears the /tmp directory of all files and directories older than 10 days. Good general housekeeping. jlh
echo "" >> ~/daily_process # blank spacer
echo '*** /tmp file prior to housekeeping' >> ~/daily_process
ls -l /tmp >> ~/daily_process
touch /tmp/lost+found #need to keep lost+found in /tmp for recovery purposes
find /tmp -mtime +10 -type f -exec rm -Rv {} \; # remove files older than 10 days
find /tmp -mtime +10 -type d -exec rm -Rv {} \; # remove directories older than 10 days
echo '' >> ~/daily_process # blank spacer
echo '*** /tmp file after housekeeping' >> ~/daily_process
ls -l /tmp >> ~/daily_process
echo '' >> ~/daily_process # blank spacer
echo '*** chkconfig checkup ' >> ~/daily_process
chkconfig --list >> ~/daily_process
echo '' >> ~/daily_process # blank spacer
This is just a routine I use to do manually. I put it all in this little script and direct to a file and then just email me the file in the morning. Cron submits the job. I cannot get the #!/bin/sh to work... gives me : bad interpreter: No such file or directory when I uncomment that line.
This script runs without any problem on RH7.3.
|
|
|
08-11-2003, 02:38 PM
|
#4
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Does it work from a terminal?
You can replace #!/bin/sh with #!/bin/bash
What does your cron line look like. Try redirecting errors and output from the script to a log eg:
0 0 * * * some.command 2>&1 /root/daily_process.log
I can only think that echo is doing something funny or isn't in your path.
|
|
|
08-11-2003, 02:56 PM
|
#5
|
Member
Registered: Jan 2003
Location: des moines, ia
Distribution: suse RH
Posts: 129
Original Poster
Rep:
|
I figured it out from reading RH website post.
It appeas that since I ftp'd this script from one box to the new, the linefeed got messed up as a DOS linefeed. I just copied and pasted each line to a new script. That worked. The post mentioned using dos2unix or td -d '\r' <script> script.new. I could not get that to work.
|
|
|
All times are GMT -5. The time now is 02:21 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|