从Root运行Shell脚本

时间:2016-05-03 11:55:23

标签: unix permissions root

我编写了一个shell脚本来加载系统并在unix环境中的用户中创建日志,哈希映射和memoray映射。它运行得非常好。下面只是shell脚本的快照。

`   export HOME=/home/comp
     cd $HOME
    . ./.bashrc
    cd -
   function start_OMS
    {
    if test $? -ne 0; then
    echo "Connection to oracle has failed. System cannot start without oracle connection."
        echo "Please check matrix.ini file / oracle is up"
        exit 0;
    fi;
    Resour >> $LOGDIR/log.Resour
    if test $? -ne 0; then
            echo "Resour failed. System might be already running. Please check the status of processes."
            echo "If no processes are running, you can clean all resources by running RmLockSystem and then RmQueueShm from $HOME/Application/Exec/Run directory"
            exit 0;
    fi;

    echo "Load Shared Memory "}`

但是当我运行相同的shell脚本时,创建的所有日志,哈希文件和内存映射都将root作为所有者。我只是shell脚本的初学者,所以任何人都可以告诉我如何将所有者更改为当前用户而不是root用户。

0 个答案:

没有答案