Crontab Environments


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Crontab Environments
# 1  
Question

I have a user trying to execute a command,in crontab, which requires certain envrionmental variables to be set. He is using tcsh on a Solaris 7 system. I have created a hack by doing the following in the crontab entry...

0 0-23 * * * rsh localhost -l user /path/command

This doesn't seem secure to me.

Any suggestions will be greatly appreciated.

SmartJuniorUnix

[Edited by SmartJuniorUnix on 05-01-2001 at 01:52 PM]
# 2  
Just set the environment variables directly in crontab (you can seperate commands with a semi-colon), or put everything in a script, and have crontab excute the script. If you want your .profile (or .cshrc or .login or whatever) to be executed, you will have to do it explicitly in your crontab entry.
# 3  
I think what he is missing is the EDITOR variable. To use vi, execute
Code:
EDITOR=vi; export EDITOR

He may also need to be in the /etc/cron.d/cron.allow file on the local host
# 4  
PXT,
From what you are saying, it seems as though I can execute a command from crontab prior to running any entries

eg:

/path/.profile
* * * * * command1
* * * * * command2

It this acurate?

Thanks
# 5  
Not quite. You would have to do something like:

* * * * * source .profile ; /bin/your_command


Some versions of cron (such as Vixie Cron which is the version running on most Linux machines) will also allow you to have entries such as:

MYVAR="1"


to set environment variables. Check the man page for your crontab to see if it is supported in your version.
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #541
Difficulty: Medium
In a statically typed language, a variable cannot be declared before it can be used.
True or False?

9 More Discussions You Might Find Interesting

1. Linux

Switch Desktop Environments via Terminal

Hi All, Does anyone know if it's possible to switch desktop environments via the terminal? I'm writing a script to install Cinnamon on Ubuntu and I would then like to remove unity but at the moment I have to ask the user to log out, log in with cinnamon and then continue the script to remove... (1 Reply)
Discussion started by: maerlyngb
1 Replies

2. AIX

Script to validate between two environments

Hi, I trust that you are well - I'm a bit new into AIX and I've been assigned a task to write a script that will always validate between our two Prod (Prod A and Prod B) environments to confirm which prod we live at. The two environments are exact replicas and this check I need to put in... (5 Replies)
Discussion started by: Twaggzk
5 Replies

3. Shell Programming and Scripting

Automating the task in two environments

Hi all, I have a task which need to be done in two test environment.both the script does the same work.i am plannig to automate that like writing a perl program to execute the script in parallel in both the test environment.i am able to call the unix script from the using in both the... (3 Replies)
Discussion started by: pals70423
3 Replies

4. UNIX for Dummies Questions & Answers

Question on Rehosting the Environments.

Hello All, We were planning to re host or change the environments (DEV,UAT & Prod) from one server to a different or new servers on a different host. So we have Informatica, Oracle software installed on our existing servers, since we upgraded the Informatica a couple of times there were many... (0 Replies)
Discussion started by: Ariean
0 Replies

5. UNIX for Dummies Questions & Answers

Description of Environments Supported By....

Im a learner on the unix/linux OS,i wanted a description of the main environments supported by the unix/linux environment. Thanks (2 Replies)
Discussion started by: zizu
2 Replies

6. Answers to Frequently Asked Questions

Unix environments for MS Windows

We often get questions about how to provide a Unix environment under Windows. Mircosoft has several OS's that collectively are called Windows. Most users are running a recent Microsoft OS with an NT kernel, usually Windows XP. The solutions in this thread may not work on very old Microsoft... (0 Replies)
Discussion started by: Perderabo
0 Replies

7. UNIX for Dummies Questions & Answers

Unix environments to fiddle around with

I'm a newbie and I was wondering if there were any public unix environments on the internet I could telnet to and fiddle around with?? (1 Reply)
Discussion started by: eloquent99
1 Replies

8. UNIX for Dummies Questions & Answers

Declaring variable environments in .cshrc

Hi All, I have been trying to set variable environment for the JAVA_HOME but it doesn' work. The path set is as follows setenv JAVA_HOME "/usr/local/jdk1.3" setenv PATH $JAVA_HOME/bin setenv CLASSPATH ${JAVA_HOME}/lib/tools.jar:{JAVA_HOME}/lib/dt.jar can anyone suggest Me where am I and... (2 Replies)
Discussion started by: v_sharda
2 Replies

9. Shell Programming and Scripting

setting environments

Hello, How can I setup environments in a bash and tcsh? I need to setup some paths and classpath. thanks xNYx (3 Replies)
Discussion started by: xNYx
3 Replies

Featured Tech Videos