Why execute a command with exec is unsuccessful within the script, put it on the server command line, and I've configured it in/etc/sudoers.

Source: Internet
Author: User
Shell

I first made the following configuration in/etc/sudoers

And then restarted the next Apache server.
Within the TP frame, write to
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 ');

Run under, no effect, transcoding is not successful, the code directly out can be executed.

At the same time, I wrote the transcoding section into a shell script.
#!/bin/shturncode () {local pdf= ' echo $ | cut-d:-f1 '; local file= ' echo $ | cut-d:-f2 '; echo $pdf; echo $file;  '/usr/bin/unoconv--server localhost--port 8100-o $pdf-F PDF $file '}action= ' $ "setting=" $ "case $action in    turncod e)        turncode "$setting"    ;;    *)    ;; Esac

Called by exec
EXEC ("sudo./bash turncode $save _path1: $file _path1", $out, $status);

The result is still unable to transcode, who has been kindly pointed out, not very grateful!!!


Reply to discussion (solution)

command line, you are using the permissions of your account. The script can be different, completely controlled by the owner or the creator's account permissions.

Oh, it's done.
1, configure Visudo to Apache users to set permissions, specific operation
Comment out Defaults Requiretty
Add www all= (All) Nopasswd:all
2. Restart Apache Service/usr/local/webserver/apache2/bin/apachectl restart

  • Related Article

    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.