rsh in crontab for solaris 7


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users rsh in crontab for solaris 7
# 1  
Old 07-01-2003
rsh in crontab for solaris 7

I am putting a shell script in cron of root for solaris 7 server . This shell script runs rsh
commands within the script. The result is the shell script does not run in cron. The cron syntax is perfect.

When I run stand alone manually it works fine.I undesrstand I need to initialize everything in cron and nothing should be taken for granted in cron . However I don't know what should I set for rsh command .

For more information the remote server is solaris 8.

Please guide.
# 2  
Old 07-01-2003
I assume that have created a shell script in a file somewhere and you put the name of that file into cron. Is that the case? Literally putting the script into crontab is hard and frequently results in errors.

Are there any error messages in /var/cron/log?

Really you should do a:
exec > /tmp/some.log.file 2>&1
very early in the script to catch the error messages.
# 3  
Old 07-02-2003
further query

Yes u r right. I have put in the shell script location in the cron ditto.

I understand we can do so however all scripts which creates environment the user (root in this case) also have to be put in cron.

I think u mean following command to be placed in my cron

exec my_shell_script > log.file 2 > &1 .

Correct me if wrong . My knowledge of cron and exec is poor .
# 4  
Old 07-02-2003
No, I mean what I said. Put the line I gave inside the shell script. Near the top. Don't add stuff to it. Now when you run the shell script the output will go to the file you specify.

Then in crontab, just put the name of the script.

Post the script. And post the crontab line.

Did you check cron's logs?
# 5  
Old 07-03-2003
here is the script

Here is the shell script duplicate which we put in solaris 7 server' cron. This script calls 3 script (2 on remote server) and 1 on local server . 2 remote server script started with rsh are also included here.

I am yet to try ur suggestion exec . I'll try that. Further I also checked the PATH and SHELL variable are not defined correctly in cron. PATH does not have /usr/sbin . I am yet to test defining this variables in the script.

The shell script duplicate works perfectly when run manually.

So I think I have to do testing of your suggestion andmy findings regarding environment variables.

Here are the scripts.

***************duplicate **************
name=$1
rsh jewelex1 "/home/vishal/scrp/takesnap $name"

mkdir /snap$name
mount -F nfs -o ro jewelex1:/snap$name /snap$name
if grep snap$name /etc/mnttab >/dev/null ;then
echo " Snap$name mounted Successfully! "
su tbase -c "/home1/tbase/snapcmp $name"
umount /snap$name;
else
echo " Snap$name not mount on `hostname` Server only! ";
fi
rm -r /snap$name
rsh jewelex1 "/home/vishal/scrp/rmsnap $name"

echo "Duplication Completed!"
**************script rmsnap *************8
name=$1
if fssnap -i |grep $name >/dev/null ;then
echo "Snapshoot on $name present.Please wait as it is Removed First"
unshare /snap$name
if grep snap$name /etc/mnttab >/dev/null ;then
echo "Snapshoot on $name Being UNMounted "
umount /snap$name
if grep snap$name /etc/mnttab >/dev/null ;then
echo "Unmounting of Snapshoot on $name not possible!***"
exit;
else
fssnap -d /$name;
fi
else
fssnap -d /$name;
fi
rm -r /snap$name;
rm -r /arch/bs$name;
fi
************script takesnap***************

name=$1
/home/vishal/scrp/rmsnap $name
if fssnap -i |grep $name >/dev/null ;then
echo "Snapshoot on $name still present.Please Remove it First"
exit;
else
echo "Snapshoot on $name Being Taken.Please Wait!"
mkdir /snap$name
mkdir /arch/bs$name
fssnap -F ufs -o bs=/arch/bs$name /$name
sno=`fssnap -i|grep $name |awk '{print $1}'`
echo "Snapshoot No $sno on $name Being Mounted.Please Wait!"
mount -F ufs -o ro /dev/fssnap/$sno /snap$name
if grep snap$name /etc/mnttab >/dev/null ;then
echo "*********Snapshoot No $sno on $name Mounted Successfully**
*****"
echo "Snapshoot No $sno on $name Being Shared"
share -F nfs -o ro /snap$name /snap$name;
else
echo "Snapshoot No $sno on $name Could not be Mounted";
fi
fi
# 6  
Old 07-03-2003
Here is one trick that I use to debug stuff like this....

Type
env - /usr/bin/ksh

This will start up an instance of ksh with nothing at all in the environment. (ksh will then add a couple of things.) Then try your script manually. This way you can see how it works with no environment variables set.
# 7  
Old 07-03-2003
working now

It is working now . I noticed 2 variables were not set . I set the same and tested. It's working now.

BTW , thanks a lot for ur help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

rsh logs in Solaris

Hi we run rsh (password-less) among solaris 9/10 boxes very frequently and would like to know if there exist any logs which will capture either login session or the commands run (using rsh) or with any other info. TIA Reddy (0 Replies)
Discussion started by: reddyr
0 Replies

2. UNIX for Dummies Questions & Answers

vxWorks connection to solaris 9.0 rsh vs ftp problem

Can anyone point me in the right direction.. I have a test system which requires vxWorks to be loaded via TCPIP I am using a Sun ultra10 box with Sol 9.0 installed as the server I have configured the server and am able to load the boot image without any problems. I assume it is using the... (0 Replies)
Discussion started by: shortsrkt
0 Replies

3. Solaris

Unable to execute commands using rsh in Solaris 9 and 10.

Unable to execute commands using rsh in Solaris 9 and 10. When I execute this command " rsh -n 172.16.67.91 ls -l " I am getting this error message. ::ffff:172.16.67.91: Connection refused Please guide me how to enable rsh. Thanks & Regards Durgaprasad (1 Reply)
Discussion started by: durgaprasadr13
1 Replies

4. Solaris

crontab in solaris

hi I want to run a script every 30 minutes in Solaris 10 x86 I tried 0,30 * * * * /tmp/script.sh but it does not run. any idea? (1 Reply)
Discussion started by: melanie_pfefer
1 Replies

5. Solaris

stop rsh in solaris

dear all Please suggest how to stop rsh on Solaris 10 Thanks murad jaber (2 Replies)
Discussion started by: murad.jaber
2 Replies

6. UNIX for Dummies Questions & Answers

RSH, Solaris and AIX

All, I have two AIX 5.3 systems that needs to run rsh commands on a Solaris 8 system, and one is failing. One, xx402 is a dedicated machine, and the other, xx452 is a virtual one on (via VIO). The xx402 has no problem with the rsh commands but I keep getting "Permission Denied" when the... (5 Replies)
Discussion started by: kjbaumann
5 Replies

7. Solaris

rsh commands not getting executed from Solaris 10 System to AIX System

Hi Friends, I am trying to execute rsh commands from Solaris 10 system to AIX system. When I give; Solaris10# rsh <hostname> ls -l , it gives me an error rshd : 0826-826 The host name for your address is not known At the same time, Solaris10# rsh <hostname> ---- gives me remote shell of... (25 Replies)
Discussion started by: jumadhiya
25 Replies

8. Solaris

Different edit crontab at Solaris..?

Hi.. At linux I can edit crontab with command $crontab -e BUT I don't know to edit crontab at Solaris because I tried with command $crontab -e I can't do that Can you help me...? Thanks for solution regards, srilinux (25 Replies)
Discussion started by: srilinux
25 Replies

9. Solaris

how to stop rsh on solaris 10

Hi Guys, Please suggest how to stop rsh on Solaris 10 Thanks Manu (1 Reply)
Discussion started by: b_manu78
1 Replies

10. UNIX for Dummies Questions & Answers

How to enable rsh on Solaris 5.9 and Tru64 4F

Hi everyone, I'n new on this... And I don't have experience. I need to know how to enable rsh between solaris and tru64. I don't know what i need to modify or install. I really don't have idea. If somebody has documentation about this, or has a procedure to do this. I really will... (1 Reply)
Discussion started by: cm247a
1 Replies
Login or Register to Ask a Question