Solved

run "crontab -e" without terminal

Posted on 2001-09-12
5
447 Views
Last Modified: 2008-02-01
Hi!

I have a linux-box, where I only have ftp-access and procmail!

I want to install a cron-job.
The only way how I can run jobs with my user-id is IMHO procmail!

for this I would need a solution how to make something like:

vi < input.txt

input.txt:
---
iTEST^[:wOUT1
:q                                                                                                            

---

this doesn't work because vi wants a terminal - any ideas??

thanks
witty
0
Comment
Question by:witty
5 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6477590
echo TEST > OUT1
0
 
LVL 1

Author Comment

by:witty
ID: 6478644
but I don't want to write to a file, but to "crontab"!
"crontab -e" opens an editor!

echo TEST | crontab -e
or
cat file | crontab -e
or
crontab -e < file

don't work:
Vim: Warning: Input is not from a terminal

witty
0
 
LVL 8

Accepted Solution

by:
mnashadka earned 150 total points
ID: 6479125
echo "* * * * * iTEST > OUT1" > cron_file
crontab cron_file

Hope this helps.
0
 
LVL 4

Expert Comment

by:garisoain
ID: 6481362
Hey there,

if you want to edit your crontab via command line, you must use redirection, and filters.
example to add a line:
cp /var/spool/cron/crontabs/<user> temp-cron
echo "Crontab entry" >> temp_cron
crontab temp_cron

example to delete a line containing a command called "wakeup":
cp /var/spool/cron/crontabs/<user> temp-cron
grep -v wakeup temp-cron > temp-cron
crontab temp_cron

example to substitute a command called "one" with another command called "two":
cp /var/spool/cron/crontabs/<user> temp-cron
sed s/one/two/g temp-cron > temp-cron
crontab temp_cron

Remember that <user> stands for the user you're using.

hope this helps...-garisoain
0
 
LVL 1

Author Comment

by:witty
ID: 6481658
mnashadka and garisoain:

thanks for your comment - oops I didn't know, you can run "crontab <file>"
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Python variable _ manually assigned 9 83
Exchange 2010 unable to mount DB due to corruption 11 110
ftp to port 21 4 43
VMware Tools Install On Linux Problem 3 61
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
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.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

770 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