开发者

Startup script fails because program not found, yet works when computer is booted

This is my Bash script /etc/init.d/test: All it's doing is running md5deep on /usr/local/bin, which calculates the md5 checksums of each file.

#!/bin/bash
cd /usr/local/bin
md5deep * 2>&1 | tee /exe/zlog2.txt

When running it on my computer, this is the output:

root@beagleboard:~# /etc/init.d/test
aed52c61934a5b6c113d535e41bd7dd1  /usr/local/bin/gfcombine
149d9c8e711d772daf7bbb6c40cf630a  /usr/local/bin/gfsplit
08ed28c2febb9e21de504b206583b75d  /usr/local/bin/hashdeep
1575f479acab5fe3bee0046cc12d86e1  /usr/local/bin/md5deep
69109d35be14662c090316e2656dd546  /usr/local/bin/sha1deep
82bd68ce9658038d80ca62e4dec74ce9  /usr/local/bin/sha256deep
ee475a6c7d2d75016d5cb5b5a1df9e1b  /usr/local/bin/stunnel
2aca377e96b82a4f944d3224656b4743  /usr/local/bin/stunnel3
1118f6115880cb106cfb8928cab89241  /usr/local/bin/tigerdeep
405becadbfff425c193c363da812443b  /usr/local/bin/whirlpooldeep

I added this script to the startup via 1) crontab, 2) update-rc.d test start 60 2 3 4 5 . and 3) update-rc.d test start 99 2 3 4 5 .

The output of that log file is as follows:

root@beagleboard:/usr/local/bin# cat /exe/zlog2.txt 
/exe/test: line 3: 开发者_StackOverflowmd5deep: command not found

I have run into problems before where commands weren't found because they weren't loaded, but I tried starting it up way after everything else. Does anyone know how to fix this?

Thank You!

-Eddie


Put source /etc/profile in your script, after the #!/bin/bash line - this'll setup your path so md5deep can be found.


You can change the script to call /usr/local/bin/md5deep instead of just md5deep. Then you don't have to load anything else or modify the path.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜