LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-06-2010, 04:33 PM   #1
rhklinux
Member
 
Registered: Jan 2010
Location: india/pune
Distribution: Arch Fedora20
Posts: 126

Rep: Reputation: 18
how to use cron to install new softwares


i am a newbie !
i want to install new softwares using cron , i tried shell script :
apt-get -y install packname and run the script using cron.
it is not working
so then i installed cron-apt but i am not able to understand how to use it
 
Old 08-06-2010, 04:42 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

You should be able to use EITHER apt-get or cron-apt in batch mode, with "cron".

Please read this article - it might help with some of the problems you've been having:

http://www.builderau.com.au/program/...9279542,00.htm

Then please try again. If you encounter problems, or have questions, then please open a new post. Always, please try to be as specific as possible:

1. Exactly what steps did you try?
2. Exactly what went wrong (cut/paste error messages, if possible)

'Hope that helps .. PSM
 
Old 08-07-2010, 12:40 AM   #3
rhklinux
Member
 
Registered: Jan 2010
Location: india/pune
Distribution: Arch Fedora20
Posts: 126

Original Poster
Rep: Reputation: 18
1)crontab.txt contains....
Quote:
time apt-get -y install ark
2)crontab crontab.txt

i want this to install ark on given time but it was not so !!
 
Old 08-07-2010, 12:40 AM   #4
rhklinux
Member
 
Registered: Jan 2010
Location: india/pune
Distribution: Arch Fedora20
Posts: 126

Original Poster
Rep: Reputation: 18
i have also tried
Quote:
time apt-get -y install ark >> something.txt
and something.txt contains nothing after the time

Last edited by rhklinux; 08-07-2010 at 12:44 AM.
 
Old 08-09-2010, 08:38 PM   #5
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Does the "cron" user have root permission to run "apt-get"?
 
Old 08-10-2010, 11:12 AM   #6
rhklinux
Member
 
Registered: Jan 2010
Location: india/pune
Distribution: Arch Fedora20
Posts: 126

Original Poster
Rep: Reputation: 18
I don't have root permissions.
but now i logged in as a root and run the script again :
script:
Quote:
33 21 10 8 2 apt-get -y install ark > log.txt
log.txt:
Quote:
Reading package lists...
Building dependency tree...
Reading state information...
Suggested packages:
ncompress zoo p7zip-full
The following NEW packages will be installed:
ark
0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
Need to get 0B/208kB of archives.
After this operation, 1040kB of additional disk space will be used.
the same command is installing ark when i typed it on terminal manually so why can't cron do it ??
 
Old 08-10-2010, 11:44 AM   #7
rhklinux
Member
 
Registered: Jan 2010
Location: india/pune
Distribution: Arch Fedora20
Posts: 126

Original Poster
Rep: Reputation: 18
i have the following mail from cron:
Quote:
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:
dpkg: warning: 'ldconfig' not found on PATH.
dpkg: warning: 'start-stop-daemon' not found on PATH.
dpkg: warning: 'update-rc.d' not found on PATH.
dpkg: 3 expected program(s) not found on PATH.
NB: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
E: Sub-process /usr/bin/dpkg returned an error code (2)
 
Old 08-10-2010, 12:28 PM   #8
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Ah, progress! Now we understand at least part of the problem:
Quote:
http://adminschoice.com/crontab-quick-reference

5. Crontab Environment
cron invokes the command from the user’s HOME directory with the shell, (/usr/bin/sh).

cron supplies a default environment for every shell, defining:

HOME=user’s-home-directory
LOGNAME=user’s-login-id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh
Solution?
Add an explicit "PATH=..." at the top of your script.

EXAMPLE:
export PATH=/usr/bin:/usr/sbin:.:/sbin:

(both "ldconfig" and "start-stop-daemon" should be in "/sbin")

'Hope that helps .. PSM

PS:
I found this link helpful - you might, too:
http://www.pantz.org/software/cron/croninfo.html

PPS:
You can also add the "PATH=..." line to the top of your crontab entry, too.

Last edited by paulsm4; 08-10-2010 at 05:01 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to install different softwares? cll975dll Linux - Software 1 05-23-2009 07:45 AM
how to install softwares from other os like windows and also run portable softwares rudramurthy Linux - Newbie 6 10-16-2008 06:33 AM
Where to install Softwares ismailkimyacioglu Linux - Newbie 16 03-13-2007 05:24 AM
how to install softwares shamsher alam Linux - Software 3 06-22-2005 08:54 AM
where to install softwares LordFrancis Linux - Newbie 4 09-29-2004 07:15 AM


All times are GMT -5. The time now is 07:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration