English 中文(简体)
壳体:Cronjob诉用户权利
原标题:Shell-Script: Cronjob vs. user rights

也许是一个容易的问题,但我感到困惑:

When I run the following script manually, it works fine. While I am not running this script as user git but as user X I am able to use the ls and du commands which are applied to git users home directory. If I try to run this script in a cronjob, these two commands are not regular invoked, don t know why. The first "extern" invocation of a cmd-file works perfect in both cases and yields a regular output.

我已注意到: 我仅能将文字作为用户X,有/有缺陷,并储存在用户家名录上。

Cron与用户X的特权。

......?

文本:runbackup.sh:

#!/bin/bash

/cygdrive/e/xp-batches/backup.cmd > info.log
echo "### CURRENT HOMEDIR ###" >> info.log
ls -gh --block-size=K /home/git >> info.log
echo "### SIZE ###" >> info.log
du -hs /home/git >> info.log
email -s "Backup Status" [email protected] < info.log
最佳回答

更不用说什么环境会给你带来。 采用全面途径:

/bin/ls -gh - block-size=K /home/git >> info.log

而不是仅仅“ls”。

Oh,可能使用一条绝对的道路,而不是无动于衷。 记录也是如此。

问题回答

暂无回答




相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签