You are not logged in.

#1 2011-08-10 13:21:13

archlinux2011
Member
Registered: 2011-07-16
Posts: 38

beginner bash script issues with cron

i did the following:

#!/bin/bash
pacman -Syu | tee -a /update.log

and i set it with permissions of 4755 and it runs but says not permitted unless root but it should since i gave it SUID bit. i want it to run each morning and just grab all the updates available.

i did this and installed it in my crontab but maybe if i put it into the root crontab?

Last edited by archlinux2011 (2011-08-10 13:58:16)

Offline

#2 2011-08-10 13:23:49

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: beginner bash script issues with cron

Unattended upgrades are strongly discouraged, but if you must, use sudo. Also, pacman already has a log.

Offline

#3 2011-08-10 13:26:01

archlinux2011
Member
Registered: 2011-07-16
Posts: 38

Re: beginner bash script issues with cron

im using this to test writing scripts since i dont know of anything else useful. also where should i put them? should i create a /bin in my home directory?

Last edited by archlinux2011 (2011-08-10 13:26:29)

Offline

#4 2011-08-10 13:27:46

lunar
Member
Registered: 2010-10-04
Posts: 95

Re: beginner bash script issues with cron

@archlinux2011:  For security reasons linux ignores the SUID-Bit on scripts.

Offline

#5 2011-08-10 13:30:06

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: beginner bash script issues with cron

How often will you read the log?

Offline

#6 2011-08-10 13:48:54

archlinux2011
Member
Registered: 2011-07-16
Posts: 38

Re: beginner bash script issues with cron

i was using the log to test things. i rewrote it to be this:

#!/bin/bash
date >> /home/<username>/dateout.log

again just to test things and its in crontab as

*/*5 8 * * * /home/<username>/bin/dateout.sh

and it doesnt seem to work.

this is to get used to writing scripts and becoming familiar with cron so its nothing useful just a small test.

Offline

#7 2011-08-10 13:55:57

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: beginner bash script issues with cron

archlinux2011 wrote:

this is to get used to writing scripts and becoming familiar with cron so its nothing useful just a small test.

I think you should pick another title for this thread.

Offline

#8 2011-08-10 13:58:27

archlinux2011
Member
Registered: 2011-07-16
Posts: 38

Re: beginner bash script issues with cron

karol wrote:
archlinux2011 wrote:

this is to get used to writing scripts and becoming familiar with cron so its nothing useful just a small test.

I think you should pick another title for this thread.

changed it

Offline

#9 2011-08-10 14:10:08

mrstegeman
Member
Registered: 2011-05-09
Posts: 21

Re: beginner bash script issues with cron

archlinux2011 wrote:

i was using the log to test things. i rewrote it to be this:

#!/bin/bash
date >> /home/<username>/dateout.log

again just to test things and its in crontab as

*/*5 8 * * * /home/<username>/bin/dateout.sh

and it doesnt seem to work.

this is to get used to writing scripts and becoming familiar with cron so its nothing useful just a small test.

I think you crontab should say

*/5 8 * * * /home/<username>/bin/dateout.sh

That'll run every 5 minutes from 8:00 - 8:55, if that's what you were going for.

Offline

#10 2011-08-10 15:02:14

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,324

Re: beginner bash script issues with cron

Read again lunar's post.  Is this a user cron job, or a system cron job.  If I missed that, I'm sorry -- I'm hurrying off to a meeting.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB