Re: [expert] urpmi doesn't run from script
Try su - -c 'command' Normal su (and kdesu I think) inherit the current user environment, the dash tells it to spawn a new one based on root. There are differences in the default path etc when running programs in this way which can cause obscure failures. BillK On Thu, 2001-11-15 at 07:27, bascule wrote: further to this i have discovered the following: the following script will work when run from a console su'ed to root: #!/bin/sh echo DEFANGED.0 exit #!/bin/bash urpmi.update localcooker so will the following: #!/bin/bash urpmi.update localcooker /dev/null 2 /dev/null neither, when invoked ising alt-f2 and kdesu, will run, i think this is related to why i cannot get the script mentioned below to work from a root cronjob if someone could help me out here i would be very grateful, i cannot work out the difference between 'kdesu /path/to/somescript' and su'ing to root in a console and running '/path/to/somescript' clearly there is but it defeats me bascule On Monday 12 Nov 2001 8:59 pm, you wrote: i have a little script that i run every now and then as follows: #!/bin/bash #this runs rsync to update the local copy of cooker rsync -avL --delete --delete-after fr2.rpmfind.net::linux/Mandrake-devel/cooker/i586/ /mandrake/cooker/ /dev/null 2 /dev/null #this updates urpmi database urpmi.update localcooker /dev/null 2 /dev/null the problem is that the last line works fine if pasted into a console, and the first line clearly works since i can see both the name of the script and rsync listed in ksysguard, however, urpmi never runs when running the script, i'm probably going to kick myself when i find out what i'm missing but i just can't work out what's wrong since the same urpmi line does work when run manually help gratefully received :-) bascule p.s. anyone wishing to confirm whether i need both --delete options to only delete old files 'after' syncing them-please feel free, the man pages for rsync weren't clear on this point This message has been 'sanitized'. This means that potentially dangerous content has been rewritten or removed. The following log describes which actions were taken. Sanitizer (start=1005781766): Part (pos=2507): SanitizeFile (filename=unnamed.txt, mimetype=text/plain): Match (rule=2): Enforced policy: accept Defanged UNIX shell script(s). Part (pos=4308): SanitizeFile (filename=message.footer, mimetype=text/plain): Match (rule=default): Enforced policy: defang Replaced mime type with: application/DEFANGED-1 Replaced file name with: message_footer.DEFANGED-1 Total modifications so far: 2 Anomy 0.0.0 : Sanitizer.pm $Id: Sanitizer.pm,v 1.32 2001/10/11 19:27:15 bre Exp $ Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [expert] urpmi doesn't run from script
thanks, i sort of see what you mean, this might explian why kdesu doesn't do it, though #su password #./somescript does work without the dash, unfortunately, it's not a reason that might explain why a cron job run as root (setup with webmin) that calls the script would fail, would it? i have wondered if the problem lies with calling one script - urpmi - from another, but since my knowledge of perl is slightly less than my knowledge of bash i.e. zero i couldn't possibly investigate this! bascule p.s. is that 'defanged' thing some sort of unixy joke, or is quoting scripts in mails a genuine security risk? On Thursday 15 Nov 2001 12:05 am, you wrote: Try su - -c 'command' Normal su (and kdesu I think) inherit the current user environment, the dash tells it to spawn a new one based on root. There are differences in the default path etc when running programs in this way which can cause obscure failures. BillK Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [expert] urpmi doesn't run from script
You can use the dash with kdesu as well I think. Also, do some reading man cron and I think you will find that cron actually uses a particular restricted environment, hence your errors. I have got around this in the past by putting the job in a script file that sets the environment and which is called by cron. BillK On Thu, 2001-11-15 at 08:34, bascule wrote: thanks, i sort of see what you mean, this might explian why kdesu doesn't do it, though #su password #./somescript does work without the dash, unfortunately, it's not a reason that might explain why a cron job run as root (setup with webmin) that calls the script would fail, would it? i have wondered if the problem lies with calling one script - urpmi - from another, but since my knowledge of perl is slightly less than my knowledge of bash i.e. zero i couldn't possibly investigate this! bascule p.s. is that 'defanged' thing some sort of unixy joke, or is quoting scripts in mails a genuine security risk? On Thursday 15 Nov 2001 12:05 am, you wrote: Try su - -c 'command' Normal su (and kdesu I think) inherit the current user environment, the dash tells it to spawn a new one based on root. There are differences in the default path etc when running programs in this way which can cause obscure failures. BillK This message has been 'sanitized'. This means that potentially dangerous content has been rewritten or removed. The following log describes which actions were taken. Sanitizer (start=1005784787): Part (pos=2813): SanitizeFile (filename=unnamed.txt, mimetype=text/plain): Match (rule=2): Enforced policy: accept Part (pos=3880): SanitizeFile (filename=message.footer, mimetype=text/plain): Match (rule=default): Enforced policy: defang Replaced mime type with: application/DEFANGED-18 Replaced file name with: message_footer.DEFANGED-18 Total modifications so far: 1 Anomy 0.0.0 : Sanitizer.pm $Id: Sanitizer.pm,v 1.32 2001/10/11 19:27:15 bre Exp $ Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [expert] urpmi doesn't run from script
from man cron and man 5 crontab it seems that only SHELL, LOGNAME and HOME are set, since the script itself can specify a shell? i assume there is some additional environment variable that is set in a console that affects the running of urpmi, thanks for the pointer bascule On Thursday 15 Nov 2001 1:27 am, you wrote: You can use the dash with kdesu as well I think. Also, do some reading man cron and I think you will find that cron actually uses a particular restricted environment, hence your errors. I have got around this in the past by putting the job in a script file that sets the environment and which is called by cron. B Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [expert] urpmi doesn't run from script
further to my previous reply, i tried adding the following to my little script: ENV=~/.bashrc export ENV then i tried ENV=/etc/bashrc export ENV but in the end adding the following which are part of /root/.bashrc: PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin ENV=/root/.bashrc USERNAME=root export USERNAME ENV did the trick with strating the script from kdesu, i'm assuming this will work for the cron job, to be honest i thought from what i read in 'man bash' that one of the first additions would do the trick since it implies that setting ENV=~/.bashrc would also set the environment as laid out in .bashrc, i also got confused when i saw that /root/.bashrc referenced itself in setting ENV, the final little script is: #!/bin/bash PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin ENV=/root/.bashrc USERNAME=root export USERNAME ENV PATH #this updates urpmi database urpmi.update localcooker /dev/null 2 /dev/null there's probably some overkill in there but anyway thanks to you i seem to have got things working cheers bascule On Thursday 15 Nov 2001 1:27 am, you wrote: You can use the dash with kdesu as well I think. Also, do some reading man cron and I think you will find that cron actually uses a particular restricted environment, hence your errors. I have got around this in the past by putting the job in a script file that sets the environment and which is called by cron. BillK On Thu, 20 Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [expert] urpmi doesn't run from script
i did try exec, as far as i can tell from 'man bash' i just stick it at the beginning of the line right? not that i really understand the difference with using it, anyway there was still no sign of urpmi updating my local cooker source, it's not a huge deal since i can do it manually but a bit dispiriting that i can't even get a simple thing like this to work! bascule On Monday 12 November 2001 11:38 pm, you wrote: On Monday 12 November 2001 20:59 pm, bascule wrote: i have a little script that i run every now and then as follows: #!/bin/bash #this runs rsync to update the local copy of cooker rsync -avL --delete --delete-after fr2.rpmfind.net::linux/Mandrake-devel/cooker/i586/ /mandrake/cooker/ /dev/null 2 /dev/null #this updates urpmi database urpmi.update localcooker /dev/null 2 /dev/null the problem is that the last line works fine if pasted into a console, and the first line clearly works since i can see both the name of the script and rsync listed in ksysguard, however, urpmi never runs when running the script, i'm probably going to kick myself when i find out what i'm missing but i just can't work out what's wrong since the same urpmi line does work when run manually help gratefully received :-) bascule p.s. anyone wishing to confirm whether i need both --delete options to only delete old files 'after' syncing them-please feel free, the man pages for rsync weren't clear on this point - Have you tried exec?, I haven't used it with urpmi but sometimes it seems to make commands in a script work Regards pete Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
[expert] urpmi doesn't run from script
i have a little script that i run every now and then as follows: #!/bin/bash #this runs rsync to update the local copy of cooker rsync -avL --delete --delete-after fr2.rpmfind.net::linux/Mandrake-devel/cooker/i586/ /mandrake/cooker/ /dev/null 2 /dev/null #this updates urpmi database urpmi.update localcooker /dev/null 2 /dev/null the problem is that the last line works fine if pasted into a console, and the first line clearly works since i can see both the name of the script and rsync listed in ksysguard, however, urpmi never runs when running the script, i'm probably going to kick myself when i find out what i'm missing but i just can't work out what's wrong since the same urpmi line does work when run manually help gratefully received :-) bascule p.s. anyone wishing to confirm whether i need both --delete options to only delete old files 'after' syncing them-please feel free, the man pages for rsync weren't clear on this point Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [expert] urpmi doesn't run from script
On Monday 12 November 2001 20:59 pm, bascule wrote: i have a little script that i run every now and then as follows: #!/bin/bash #this runs rsync to update the local copy of cooker rsync -avL --delete --delete-after fr2.rpmfind.net::linux/Mandrake-devel/cooker/i586/ /mandrake/cooker/ /dev/null 2 /dev/null #this updates urpmi database urpmi.update localcooker /dev/null 2 /dev/null the problem is that the last line works fine if pasted into a console, and the first line clearly works since i can see both the name of the script and rsync listed in ksysguard, however, urpmi never runs when running the script, i'm probably going to kick myself when i find out what i'm missing but i just can't work out what's wrong since the same urpmi line does work when run manually help gratefully received :-) bascule p.s. anyone wishing to confirm whether i need both --delete options to only delete old files 'after' syncing them-please feel free, the man pages for rsync weren't clear on this point - Have you tried exec?, I haven't used it with urpmi but sometimes it seems to make commands in a script work Regards pete Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com