Alias script which runs with cronjob


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Alias script which runs with cronjob
# 1  
Old 10-17-2012
Alias script which runs with cronjob

Hi,

I wrote a alias script and I want to run this script every day at 10 AM. I don't want to mention this alias command in .profile(Since alias commands are nearly 30 to use).

so when I'm trying to call script with cronjob its not running, any help on this.

the script looks like :

Code:
#!/usr/bin/sh

alias history='cd /acm/mail/history'
alias log='cd /acm/mail/log'
alias smtp='cd /mca/atk/smtp'

cronjob :

Code:
*       10       *       *       *           /sed/local/amc/scripts/alias.sh.

But script is not working, any help on this.

Last edited by Scott; 10-17-2012 at 12:43 PM.. Reason: Code tags, please...
# 2  
Old 10-17-2012
The cronjob runs the script, the aliases get set, the script finishes, the aliases die.

If (and this is my assumption) you want the aliases available in your environment when you log in, the .profile is the place to put them. If it's "nicer" for you, you can put the alias commands in a separate file (as you have here in alias.sh and source that from your .profile.
# 3  
Old 10-17-2012
If all the script does is set aliases on the current cron shell then it looks like it's working.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[SOLVED] Only half my script runs

Hello out there, I got this script that runs partly fine by my crontab. Problem is it gets to the sleep 300(which should be 5 minutes right?) part and never runs the rest of the scripts past that. All individual scripts run just fine. My var/mail file only shows it up to the " echo "Loader Stop... (3 Replies)
Discussion started by: vsekvsek
3 Replies

2. UNIX for Dummies Questions & Answers

Bash script that runs permanently

Hello,Geeks How i can run my script permanently. once i run my script it should be working always. like installation. for example if i run one command once in bash script. it must be permanently run in my linux machine.. Thanks in Advance (2 Replies)
Discussion started by: dhanda2601
2 Replies

3. UNIX for Dummies Questions & Answers

Script only runs as a particular user

Hi guys So I've got this PERL script that for one reason or another I need to run as a user other than the user that created the script. When I su - to another user the script won't run and doesn't give me any output as to why. No permission denied or anything like that. I've chmod 777'd the... (5 Replies)
Discussion started by: Jaymoney
5 Replies

4. Shell Programming and Scripting

cronjob not running but runs manually

hello, i recently switched to a new ec2 box and transferred the cronjobs from the old box. For some reason one of the scripts won't work but it runs manually from the command line. I've read from previous threads it might be an environment issue but I added a line with the path to the script... (2 Replies)
Discussion started by: lencholamas
2 Replies

5. Shell Programming and Scripting

Script runs fine, but not in a cron

Okay, I have the following script that runs fine from a command line as well as an executable .sh file. It just moves any file/folder with movie* in the name to a folder called _Movies. The issue I'm running into is when it's call from a cron. find /mnt/HD_a2/BT/complete -iname "movie.*" -exec... (4 Replies)
Discussion started by: sammyk
4 Replies

6. Shell Programming and Scripting

How would you return how long a script runs for?

When running a ksh script, how would you time how long it took the script ran for? Is there a command that can capture this? (1 Reply)
Discussion started by: Jazmania
1 Replies

7. Shell Programming and Scripting

Shell script which runs sql script

Hi all, I need a shell script which runs a sql script but I couldn't find how to finish it. This is the code that I have: #! /usr/bin/ksh export SHELL=/bin/ksh export ORACLE_SID=database export ORACLE_HOME=/opt/oracle/product/9.2.0.8 sqlplus user <<EOF @/path/path/path/scriptname.sql... (3 Replies)
Discussion started by: Geller
3 Replies

8. Shell Programming and Scripting

Shell Script: want to insert values in database when update script runs

Hi , I am new to linux and also also to shell scripting. I have one shell script which unpacks .tgz file and install software on machine. When this script runs I want to insert id,filename,description(which will be in readme file),log(which will be in log file) and name of unpacked folder... (1 Reply)
Discussion started by: ring
1 Replies

9. UNIX for Advanced & Expert Users

My script runs too slow :-(...

Hello experts, I have a series issue in script that result with bad peformence and I wonder if you can assist me. For example I have two files: File-New, size 15Mb. File-Old, size 1Mb. File-New content: a b c k File-Old content: d f a b (0 Replies)
Discussion started by: roybe
0 Replies
Login or Register to Ask a Question