shell脚本中执行另一个shell脚本
可以在一个shell脚本中执行另一个shell脚本(或非可执行文件,主要用于取得一些变量的值),方法是: . 文件名(包括路径) 或 变量=文件名(包括路径) . $变量 注意,圆点后面有个空格。 这样,在本shell脚本的后面部分就可以引用其他文件中声明的一些变量。执行下cat /etc/rc.local看看这个文件,不需要任何帮助手册和文档,看完这个文件后你就有更好的办法来添加一个开机启动的服务。
#!/bin/sh -e## rc.local## This script is executed at the end of each multiuser runlevel.# Make sure that the script will "exit 0" on success or any other# value on error.## In order to enable or disable this script just change the execution# bits.## By default this script does nothing.
. /var/www/sphinx/restart.sh
exit 0
Crontab
# 全文检索30 1 * * * /bin/sh /var/www/sphinx/sphinx.sh;
# 聊天室在线用户检查脚本*/1 * * * * php /var/www/ccccccc/_TOOLS/update_online_users.php
linux if
# pimei
site=1if [ $site = 1 ] then/usr/local/coreseek/bin/indexer --config /var/www/sphinx/www.site.com/pre_portal_article_title/pre_portal_article_title.conf --all/usr/local/coreseek/bin/searchd -c /var/www/sphinx/www.site.com/pre_portal_article_title/pre_portal_article_title.conf/usr/local/coreseek/bin/indexer --config /var/www/sphinx/www.site.com/pre_portal_article_and_tag/pre_portal_article_and_tag.conf --all/usr/local/coreseek/bin/searchd -c /var/www/sphinx/www.site.com/pre_portal_article_and_tag/pre_portal_article_and_tag.conffi
转载于:https://www.cnblogs.com/bandbandme/p/3924162.html
