Why is it possible to execute a command in the script using exec and put it on the server command line? I also configured it in/etc/sudoers.

Source: Internet
Author: User
Why is it possible to execute a command in the script using exec and put it in the command line of the server? I also configured it in/etc/sudoers & nbsp; & nbsp; I first made the following configuration in/etc/sudoers & nbsp; then restarted the apache Server & nbsp; why is it possible to execute a command in the script using exec and put it on the server command line? I also configured it in/etc/sudoers.
I first made the following configuration in/etc/sudoers:

Restart the apache server.
Written in the tp framework

exec('/usr/bin/unoconv --server localhost --port 8100 -o /usr/local/webserver/www/server/Exam/Public/Uploads/Resource/transform/document/201309/52419a788a553.pdf -f pdf /usr/local/webserver/www/server/Exam/Public/Uploads/Resource/untransform/document/201309/52419a788a553.doc');

After the code is run, it is ineffective and transcoding fails. you can execute the code directly.

At the same time, I wrote the transcoding part to a shell script.

#!/bin/sh


turnCode() {
local pdf=`echo $1 | cut -d: -f1`;
local file=`echo $1 | cut -d: -f2`;
echo $pdf;
echo $file;
  `/usr/bin/unoconv --server localhost --port 8100 -o $pdf -f pdf $file`

}



action="$1"
setting="$2"
case $action in

    turnCode)
        turnCode "$setting"
    ;;

    *)
    ;;

esac


Call through exec

 exec("sudo ./bash turnCode $save_path1:$file_path1", $out, $status);

The results still cannot be transcoded. I am very grateful to anyone who has received this article !!! Shell share:
------ Solution --------------------
The command line uses the permissions of your account. Scripts can be different, and are completely controlled by the account permissions of the script owner or creator.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.