Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

run "crontab -e" without terminal

Posted on 2001-09-12
5
Medium Priority
?
464 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
[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
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 600 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month11 days, 19 hours left to enroll

636 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