LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 08-11-2003, 02:45 PM   #1
j-me
Member
 
Registered: Jan 2003
Location: des moines, ia
Distribution: suse RH
Posts: 123

Rep: Reputation: 16
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
 
Old 08-11-2003, 03:09 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
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.
 
Old 08-11-2003, 03:18 PM   #3
j-me
Member
 
Registered: Jan 2003
Location: des moines, ia
Distribution: suse RH
Posts: 123

Original Poster
Rep: Reputation: 16
##!/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.
 
Old 08-11-2003, 03:38 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
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.
 
Old 08-11-2003, 03:56 PM   #5
j-me
Member
 
Registered: Jan 2003
Location: des moines, ia
Distribution: suse RH
Posts: 123

Original Poster
Rep: Reputation: 16
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What does echo alias "char-major-10-224 off" >> /etc/modules.conf do? abefroman Linux - Software 2 09-16-2009 11:10 PM
simple "echo > qbc" cron jobs doesn't run shole Linux - Newbie 3 09-23-2006 03:09 PM
(echo -n "standby" > /sys/power/state) only allowed for root? brynjarh Debian 5 02-14-2005 10:08 AM
want full description of "echo num > / path/...." zameer_india Linux - Newbie 5 01-08-2005 04:10 AM
cannot "echo ... > /sys/.../cpufreq/scaling_setspeed" rgiggs Slackware 5 01-02-2005 11:12 PM


All times are GMT -5. The time now is 08:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration