- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: New to UNIX, how do I create a scrip and a cro...
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
Discussions
Discussions
Forums
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
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
тАО05-17-2005 04:07 AM
тАО05-17-2005 04:07 AM
Any pointers?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-17-2005 04:18 AM
тАО05-17-2005 04:18 AM
Re: New to UNIX, how do I create a scrip and a cron job?
There are other issues to be aware of as well such as the type of environment you are in. You are making a blanket request and not all solutions will fit your needs.
As to cron;
00 21 * * *
00 05 * * *
This will execute dbshut at 2100 hrs daily
This will execute dbstart at 0500 hrs daily.
Again, this is a simple version of the syntax.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-17-2005 04:20 AM
тАО05-17-2005 04:20 AM
Re: New to UNIX, how do I create a scrip and a cron job?
I believe you already have a script...
Look in /sbin/init.d/ for something oracle related...
Does you oracle instance start at bootup?
If yes then at which runlevel - most chances to be 3, so look in /sbin/rc3.d/ a Sxxxoracle or something like
All this to say you have the script you now just need to create a cron file
man cron for a start
Then check with the sysadmin if you have the rights to create/use cron
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-17-2005 05:04 AM
тАО05-17-2005 05:04 AM
Re: New to UNIX, how do I create a scrip and a cron job?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-17-2005 05:14 AM
тАО05-17-2005 05:14 AM
Re: New to UNIX, how do I create a scrip and a cron job?
who -r
To see how your script is launched, you should find in /sbin/rc2. a Kxxxfile linked to your oracle file in /sbin/init.d the same goes for rc3.d but this time you have to look for a Sxxxfile.
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-17-2005 05:59 AM
тАО05-17-2005 05:59 AM
Re: New to UNIX, how do I create a scrip and a cron job?
How this works? Do I have to create the file in /sbin/init.d and link it to /sbin/rc2.d?
I'm kind of lost here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-17-2005 10:35 AM
тАО05-17-2005 10:35 AM
Re: New to UNIX, how do I create a scrip and a cron job?
the rc.2 directory means that when the system is booted oracle starts at run level 2, the system is up at run level 3 (/sbin/rc.3/) and a whole bunch of other programs / process will be started at this level as the server is booted.
You want to stop and start oracle via cron, once you find the options from the oracle script add the following to cron:
00 21 * * * /sbin/init.d/oracle stop
00 05 * * * /sbin/init.d/oracle start.
This should do the trick.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-17-2005 05:33 PM
тАО05-17-2005 05:33 PM
Re: New to UNIX, how do I create a scrip and a cron job?
root
oracle
:wq!#then save and exit
2, get attached file for scripts
3, su - oracle
[server:/] su - oracle
exit crontab
#crontab -e
[server:/home/oracle] crontab -e
# minute hour date month weekday command
00 21 * * * sh /home/oracle/scripts/Ora_shutdown.sh
00 05 * * * sh /home/oracle/scripts/Ora_start.sh
that's all
tienna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-17-2005 09:31 PM
тАО05-17-2005 09:31 PM
Solution>On /sbin/rc2.d I found S910oracle linked to oracle in
>/sbin/init.d but on /sbin/rc3.d was nothing that I could relate to Oracle.
>
>How this works? Do I have to create the file in
>/sbin/init.d and link it to /sbin/rc2.d?
at run level 2 when the system is booting it looks sequentialy for files to start and
called S0XXXfile and gives the start option
at level 1 when system i beeing brought down
It look for Kxxxfile and give stop argument
I believe your oracle file should be in rc2.d for Kxxx and rc3 for SYYY
But its up to you...
Here is an example of what we do for start/stop scripts for oracle:
#!/usr/bin/ksh
export ORACTI_EXPLOIT=/opt/oracle/admin/exploit
export PATH=$PATH:/usr/bin:$ORACTI_EXPLOIT/proc
case "$1" in
start_msg)
echo "Start Oracle"
;;
stop_msg)
echo "Stop Oracle"
;;
start)
$ORACTI_EXPLOIT/proc/db_start
su - oracle -c $ORACTI_EXPLOIT/proc/net_start
;;
stop)
su - oracle -c $ORACTI_EXPLOIT/proc/net_stop
$ORACTI_EXPLOIT/proc/db_shut
;;
*)
echo "usage: $0 {start|stop}"
#rval=1
;;
esac
----------------------------------------
Here is an extract of a cronfile the way I do...
Notice I put conrfiles in a structure /sm/cron with big comments on the syntax
and usage since I have poor memory...
This leaves a way to modify the the cronfile by getting it at its location.
TO load it is simply crontab cronfile.root
--------------------------------------
# /sm/cron/cronfile.root
# crontab file for the super-user.
#
# ==========================================================================
# F O R M A T
# ==========================================================================
# Minute Hour Month_Day Month Weekday Command
# (0-59) (0-23) (1-31) (1-12) (0-6)*0=sun run-string
# * = in any crontab field represents all legal values.
# Therefore, to schedule the ps(1) cmd to execute at 5:10pm on every
# friday and monday during june, july, august, you would make an entry
# in your crontab fithe that looks like this :
# 10 17 * 6,7,8 1,5 ps>>psfile 2>&1
# The 2>&1 redirects any error msg to the file psfile.
# ==========================================================================
# archive annuelle de l export le 3 dimanche de janvier chaque annee
#00 04 * 1 0 /sm/bin/archive_annuelle >>/sm/log/archive_ann.er 2>&1
# log kernel diagnostic messages every 10 minutes
05,15,25,35,45,55 * * * * /usr/sbin/dmesg - >>/var/adm/messages
#05,15,20,35,45,55 * * * * /usr/bin/ulimit >>/var/adm/ulimit.cron 2>&1
#05,15,21,35,45,55 * * * * /usr/bin/ulimit -a >>/var/adm/ulimit.cron 2>&1
07,17,27,37,47,57 * * * * /var/adm/root/clean_tmp>>/var/adm/cleantmp.log 2>&1
# Sample nightly invocation of calendar. If you wish to run calendar,
# just uncomment the next line.
#0 4 * * * exec /usr/bin/calendar -
# ==========================================================================
# effacer les disques temporaires
# ==========================================================================
#
00 23 * * 1,2,3,4,5 /sm/cron/bin/effacer>>/sm/cron/log/efface.log 2>&1
05 23 * * 1,2,3,4,5 /sm/cron/bin/clean_xprt_s>/sm/cron/log/cleanXs.log 2>&1
# ============================ E N D =======================================
NOw user who are allowed to use cron or at cmd ar defined in files in /var/adm/cron:
-r--r--r-- 1 bin bin 18 Nov 14 2000 at.allow
-r--r--r-- 1 bin bin 31 Feb 12 2003 cron.allow
-rw-r--r-- 1 root root 1041016 May 18 10:47 log
in cron .allow and at.allow you give the users you are allowed:
:/var/adm/cron $ more cron.allow
root
adm
vbe
uucp
prod
rdm
dupont
-----
Courage!!
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-18-2005 02:08 AM
тАО05-18-2005 02:08 AM
Re: New to UNIX, how do I create a scrip and a cron job?
As far as oracle startup script exists in /sbin/init.d and is linked to /sbin/rc2.d.. it should suffice.
Regards