You are not logged in.

#1 2008-03-02 15:48:33

MONODA
Member
Registered: 2008-02-09
Posts: 256

crontabs

i want to make a crontab to install xfce4 with pacman but when i type crontab -e as root it opens vi with a file saying at the top not to edit it... How can i create a crontab to do what i want? btw i dont know how to use vi.

Last edited by MONODA (2008-03-02 16:03:22)

Offline

#2 2008-03-02 16:29:05

veek
Member
Registered: 2006-03-10
Posts: 167

Re: crontabs

If you'd rather use nano to edit the crontab, enter the following on the command line:

VISUAL=nano crontab -e

As long as you edit the file by issuing the crontab -e command, you can disregard the message
telling you not to edit the file manually.

Can I ask why you're using a cron job to install something? Seems a tad strange.

Assuming you want to schedule the install at, for example, 11:15 PM tonight:

<minute> <hour> <day> <month> <dow> <command>
 15 23 * * * yes | pacman -S xfce4

the crontab file already shows you what each field means.
If you want to schedule on a different day, you would have to specify the
day in the appropriate field.

Also you need to pipe the "yes" command to pacman, because otherwise pacman
will ask for confirmation before installing the requested package, and
sit there for waiting forever.

Last edited by veek (2008-03-02 16:31:13)

Offline

#3 2008-03-02 16:41:48

veek
Member
Registered: 2006-03-10
Posts: 167

Re: crontabs

Actually I would add one thing to the command above so you can see the output of pacman
after it ran. There might be important messages, and also install may fail and you won't know why:

15 23 * * * yes | pacman -S xfce4 2 > ~/pacman.out

This will redirect stderr (and pacman's output) to a file called pacman.out in root's home directory.
Make sure there's a space between '2' and '>'.

Last edited by veek (2008-03-02 16:45:14)

Offline

#4 2008-03-02 16:47:43

MONODA
Member
Registered: 2008-02-09
Posts: 256

Re: crontabs

thanks you guys the reason why i want to do this is because i have a limited download and xfce is pretty large (my limit is 1.5 :'() but i have unlimited at 11 pm untill 8 in the morning which is why i download everything then.

Offline

#5 2008-03-02 18:44:25

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: crontabs

You can set pacman just to download packages at night and then install when you are at the computer.

pacman -S --help
pacman -Syuw
pacman -Su --needed

Should work, but I couldn't test those as I just upgraded my system

Last edited by Purch (2008-03-02 18:49:09)

Offline

#6 2008-03-03 00:27:07

veek
Member
Registered: 2006-03-10
Posts: 167

Re: crontabs

Hmm...yea that's a good idea Purch. I've never used the -w (--downloadonly) option.

Changing the command in the crontab to: pacman -Syw xfce4, would allow
you to just download xfce4 and install later.

Offline

#7 2008-03-03 07:20:17

XChrisX
Member
Registered: 2007-10-21
Posts: 29

Re: crontabs

veek wrote:

Also you need to pipe the "yes" command to pacman, because otherwise pacman
will ask for confirmation before installing the requested package, and
sit there for waiting forever.

pacman --noconfirm ....etc

Takes care of the need to input the yes.
(Of course the "....etc" should be replaced with what you want pacman to do)

Offline

#8 2008-03-03 12:47:22

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: crontabs

I was bored so I made small program to automate package downloads. Scheduling is made by cron.

http://aur.archlinux.org/packages.php?ID=15485

Offline

#9 2008-03-03 17:25:13

MONODA
Member
Registered: 2008-02-09
Posts: 256

Re: crontabs

thanks you guys ill try it out tonight, it did not work yesterday because or some error, something like this:
error: mozilla-thunderbird contains thunderbird.
(i want to install thunderbird too.)

Offline

#10 2008-03-03 18:24:19

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: crontabs

Consider atd and at at as an alternative to the cron daemon: it allows to execute a daemon only one time at a certain time/date. The purpose of the cron daemon would be to execute actions automatically many times (although I realize that it is easy to change two times the crontab so that the result is the same).


Mortuus in anima, curam gero cutis

Offline

#11 2008-03-03 19:43:52

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: crontabs

patroclo7, did you reply to my post?

Anyway, refering to my package in the previous post, the script is executed by cron every night, every hour or whenever you want. Script downloads upgradable packages on every run (pacman -Syuw). Selected packages will be downloaded on next execution, if you put their names to the /etc/pacman_pkgdl. Script will do (pacman -Sw package1 package2 ...), and then it comments out the package line in /etc/pacman_pkgdl so that it wont download them again on the next execution.

Offline

#12 2008-03-03 20:18:50

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: crontabs

@ Purch No, I replied to the initial post, where MONODA wants to schedule the single execution of a specific operation (that is, the installation of xfce4 with pacman). At is designed to do this, a cron daemon seems a bit overkill


Mortuus in anima, curam gero cutis

Offline

#13 2008-03-04 14:37:50

MONODA
Member
Registered: 2008-02-09
Posts: 256

Re: crontabs

ok so at night i left my laptop to run the command:
pacman -Syw --noconfirm xfce4 xfce4-goodies gtk2-themes-collection pidgin vlc exaile gimp openoffice 2 > ~/pacman.out
since i wanted to download all of those apps only. but when i checked the log this is what i saw:
:: Synchronizing package databases...
error: failed retrieving file 'core.db.tar.gz' from ftp.archlinux.org : Connection timed out
:: group xfce4 (including ignored packages):
    exo  gtk-xfce-engine  libxfce4mcs  libxfce4util  libxfcegui4  mousepad 
    squeeze  terminal  thunar  xfce-mcs-manager  xfce-mcs-plugins  xfce-utils 
    xfce4-appfinder  xfce4-icon-theme  xfce4-mixer  xfce4-panel  xfce4-session 
    xfdesktop  xfprint  xfwm4  xfwm4-themes 
:: group xfce4-goodies (including ignored packages):
    notification-daemon-xfce  thunar-archive-plugin  thunar-media-tags-plugin 
    thunar-volman  verve-plugin  xarchiver  xfce4-artwork 
    xfce4-battery-plugin  xfce4-clipman-plugin  xfce4-cpufreq-plugin 
    xfce4-cpugraph-plugin  xfce4-datetime-plugin  xfce4-dev-tools 
    xfce4-dict-plugin  xfce4-diskperf-plugin  xfce4-eyes-plugin 
    xfce4-fsguard-plugin  xfce4-genmon-plugin  xfce4-mailwatch-plugin 
    xfce4-messenger-plugin  xfce4-mount-plugin  xfce4-mpc-plugin 
    xfce4-netload-plugin  xfce4-notes-plugin  xfce4-quicklauncher-plugin 
    xfce4-screenshooter-plugin  xfce4-sensors-plugin 
    xfce4-smartbookmark-plugin  xfce4-systemload-plugin  xfce4-taskmanager 
    xfce4-timer-plugin  xfce4-wavelan-plugin  xfce4-weather-plugin 
    xfce4-xfapplet-plugin  xfce4-xkb-plugin  xfce4-xmms-plugin 
:: group xfce4-goodies (including ignored packages):
    ristretto  xfce4-time-out-plugin 

could this be from my internet connection?
EDIT: i am able to conect to the internet(i successfully pinged google.com

Last edited by MONODA (2008-03-04 15:08:51)

Offline

#14 2008-03-05 01:05:58

mrunion
Member
From: Jonesborough, TN
Registered: 2007-01-26
Posts: 1,938
Website

Re: crontabs

Change to another mirror and don't use ftp.archlinux.org first.


Matt

"It is very difficult to educate the educated."

Offline

Board footer

Powered by FluxBB