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
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
2. Solaris
Hi Guys,
Please suggest how to stop rsh on Solaris 10
Thanks
Manu (1 Reply)
Discussion started by: b_manu78
1 Replies
3. 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
4. Solaris
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
5. UNIX for Dummies Questions & Answers
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
6. Solaris
dear all
Please suggest how to stop rsh on Solaris 10
Thanks
murad jaber (2 Replies)
Discussion started by: murad.jaber
2 Replies
7. 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
8. Solaris
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
9. UNIX for Dummies Questions & Answers
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
10. 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
LEARN ABOUT OPENSOLARIS
cron
cron(1M) System Administration Commands cron(1M)
NAME
cron - clock daemon
SYNOPSIS
/usr/sbin/cron
DESCRIPTION
cron starts a process that executes commands at specified dates and times.
You can specify regularly scheduled commands to cron according to instructions found in crontab files in the directory
/var/spool/cron/crontabs. Users can submit their own crontab file using the crontab(1) command. Commands which are to be executed only once
can be submitted using the at(1) command.
cron only examines crontab or at command files during its own process initialization phase and when the crontab or at command is run. This
reduces the overhead of checking for new or changed files at regularly scheduled intervals.
As cron never exits, it should be executed only once. This is done routinely by way of the svc:/system/cron:default service. The file
/etc/cron.d/FIFO file is used as a lock file to prevent the execution of more than one instance of cron.
cron captures the output of the job's stdout and stderr streams, and, if it is not empty, mails the output to the user. If the job does not
produce output, no mail is sent to the user. An exception is if the job is an at(1) job and the -m option was specified when the job was
submitted.
cron and at jobs are not executed if your account is locked. Jobs and processses execute. The shadow(4) file defines which accounts are not
locked and will have their jobs and processes executed.
Setting cron Jobs Across Timezones
The timezone of the cron daemon sets the system-wide timezone for cron entries. This, in turn, is by set by default system-wide using
/etc/default/init. The timezone for cron entries can be overridden in a user's crontab file; see crontab(1).
If some form of daylight savings or summer/winter time is in effect, then jobs scheduled during the switchover period could be executed
once, twice, or not at all.
Setting cron Defaults
To keep a log of all actions taken by cron, you must specify CRONLOG=YES in the /etc/default/cron file. If you specify CRONLOG=NO, no log-
ging is done. Keeping the log is a user configurable option since cron usually creates huge log files.
You can specify the PATH for user cron jobs by using PATH= in /etc/default/cron. You can set the PATH for root cron jobs using SUPATH= in
/etc/default/cron. Carefully consider the security implications of setting PATH and SUPATH.
Example /etc/default/cron file:
CRONLOG=YES
PATH=/usr/bin:/usr/ucb:
This example enables logging and sets the default PATH used by non-root jobs to /usr/bin:/usr/ucb:. Root jobs continue to use
/usr/sbin:/usr/bin.
The cron log file is periodically rotated by logadm(1M).
FILES
/etc/cron.d Main cron directory
/etc/cron.d/FIFO Lock file
/etc/default/cron cron default settings file
/var/cron/log cron history information
/var/spool/cron Spool area
/etc/cron.d/queuedefs Queue description file for at, batch, and cron
/etc/logadm.conf Configuration file for logadm
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
svcs(1), at(1), crontab(1), sh(1), logadm(1M), svcadm(1M), queuedefs(4), shadow(4), attributes(5), rbac(5), smf(5), smf_security(5)
NOTES
The cron service is managed by the service management facility, smf(5), under the service identifier:
svc:/system/cron:default
Administrative actions on this service, such as enabling, disabling, or requesting restart, can be performed using svcadm(1M). The ser-
vice's status can be queried using the svcs(1) command. Most administrative actions may be delegated to users with the solaris.smf.man-
age.cron authorization (see rbac(5) and smf_security(5)).
DIAGNOSTICS
A history of all actions taken by cron is stored in /var/cron/log and possibly in /var/cron/olog.
SunOS 5.11 4 Feb 2009 cron(1M)