?
Solved

run "crontab -e" without terminal

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

How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

Question has a verified solution.

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

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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.
Suggested Courses
Course of the Month9 days, 17 hours left to enroll

762 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