Solved

run "crontab -e" without terminal

Posted on 2001-09-12
5
444 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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

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…
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now