sdinteractive / sd-serverdiagnostics

Server Connector For MageDiagnostics
1 stars 2 forks source link

add full path for the .env file #11

Closed subbu1993 closed 7 years ago

subbu1993 commented 7 years ago

The .env file resides mainly in the same directory as that of the main.sh file

When running from cron, if you do not cd into the main.sh directory you can get the following error

/opt/sd-serverdiagnostics/main.sh: line 6: .env: No such file or directory
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information

This PR specifies the full path for the .env file.

An alternative way of handling this would be to change the crontab entry to

0 0 * * * cd /opt/sd-serverdiagnostics/ && /bin/bash /opt/sd-serverdiagnostics/main.sh
subbu1993 commented 7 years ago

Tested this locally

DTSN-05568-subbu-mac:~ sswamynathan$ /bin/bash ~/SD/Sites/sd-serverdiagnostics/main.sh 
cat: /etc/*-release: No such file or directory
head: illegal byte count -- -2
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title>404 - Not Found</title>
    </head>
    <body>
        <h1>404 - Not Found</h1>
    </body>
</html>
mpchadwick commented 7 years ago

Hmm, I see some comments expressing concern with this approach however it seems like a decent approach to me and I don't think we'll run into the issues described with the way we set this up. @toddbc do you have any thoughts / alternative suggestions?

subbu1993 commented 7 years ago

@toddbc can this be merged ?