Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Automating a script

Posted on 1999-07-08
9
Medium Priority
?
325 Views
Last Modified: 2010-04-21
I had written a shellscript in /etc and i want to execute
the script daily at 8.00AM .Is it possible to automate
in UNIX ??If yes, please send me an answer.

Thanks in advance,
Pap.


0
Comment
Question by:Papsniper
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 

Accepted Solution

by:
fuchsr earned 10 total points
ID: 2011410
You must have cron permission.  Root must add your userid
to the /var/adm/cron/cron.allow file.

If you have root permission yourself, SAM (in HPUX) can be used to set up cron.   This makes it easy since it's menu driven.
sam
Process Mgt
scheduled cron jobs
Actions - Add - Daily
Time 08:00
Enter the script name in the command blank.

It's a good idea to pipe the output and error to dev/null so that it doesn't get emailed to you.  
Command >/dev/null 2>&1

If you don't have root access, you can use:
crontab -e
Then you use vi commands to enter the crontab entry which
would look like
0 8 * * * Command >/dev/null 2>&1

Use Esc:wq! to save and exit.

The first 6 fields in the crontab file are:
# Minute(0-59) Hour(0-23) Day(1-31) Month(1-12) Day_of_week(0-6) Command






0
 

Expert Comment

by:riname
ID: 2011411
First you should make the the script file an executable file using the chmod command.
  chmod 711 yourscriptname
  or chmod 755 yourscriptname
So it will become an executable file.
Then you add that file name in the cron.
create a file named mycron and type the following line only
0 8 * * * /etc/yourscriptname
save the file

From the prompt type again
 crontab mycron

If you have permission for the cron, it will be scheduled for the following day 8am. Otherwise you tell the sysadmin to add your user name in the /var/adm/cron/cron.allow or do as in the fuchsr's comment.


0
 

Expert Comment

by:riname
ID: 2011412
First you should make the the script file an executable file using the chmod command.
  chmod 711 yourscriptname
  or chmod 755 yourscriptname
So it will become an executable file.
Then you add that file name in the cron.
create a file named mycron and type the following line only
0 8 * * * /etc/yourscriptname
save the file

From the prompt type again
 crontab mycron

If you have permission for the cron, it will be scheduled for the following day 8am. Otherwise you tell the sysadmin to add your user name in the /var/adm/cron/cron.allow or do as in the fuchsr's comment.


0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Papsniper
ID: 2011413
Hi fuchsrs,

Could you please explain what is the below statements:
-------------------------------------------------------
If you have root permission yourself, SAM (in HPUX) can be used to set up cron.   This makes it easy since it's menu driven.
sam
Process Mgt
scheduled cron jobs
Actions - Add - Daily
Time 08:00
Enter the script name in the command blank.


----------------------------------------------------------

I didnt understand what is SAM and the remaining statements
under it/

Could you be more elaborate.

By the way i got access to root and i want to execute the program at 8.00 AM.

Pap.

0
 

Expert Comment

by:fuchsr
ID: 2011414
SAM is the system administration manager.  It is a GUI based
program that makes many system administration tasks easier.  I believe it is proprietary to HP 9000 workstations and servers.   I only administer HP systems, so I have access to it at any time.   It is called up by typing "sam" when logged in as root.  I don't think HP offers it for any other UNIX variant or hardware platform.

In any case, for cron I now usually use the command line since it's faster.
0
 

Author Comment

by:Papsniper
ID: 2011415
hi,

Please read my previous comment and answer my question.

Thanks,

Pap.
0
 

Expert Comment

by:fuchsr
ID: 2011416
SAM is the system administration manager.  It is a GUI based
program that makes many system administration tasks easier.  I believe it is proprietary to HP 9000 workstations and servers.   I only administer HP systems, so I have access to it at any time.   It is called up by typing "sam" when logged in as root.  I don't think HP offers it for any other UNIX variant or hardware platform.

In any case, for cron I now usually use the command line since it's faster.
0
 

Expert Comment

by:fuchsr
ID: 2011417
Sorry, I didn't really mean to repeat myself, I clicked on the submit button not sure that I already submitted the answer.   But now that I look at you question it seems appropriate, since I believe your question is "What is SAM?" and I think I described it appropriately.  I can only assume now that you don't have an HP9000 system and, therefore, don't have SAM.
0
 

Expert Comment

by:riname
ID: 2011418
You do not have to know anything about SAM in this case.
Just follow my comment on the top box. It will be OK for the task you have.

It will solve your problem without going to SAM or your system specific GUI, sysadm for NCR, openwin for Solaris,etc.

Instead of doing it in the menu like normal MS Windows user normally unix guys do it in the command prompt. But GUI is good for MSWindows experienced user. In your case following my comment will really solve the problem.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question