Menu

#15 sar2html -c looking at old file locations

Unstable_(example)
closed
CemTan
None
5
2016-02-22
2016-02-22
d3
No

Minor issue for sar2html 3.0.0:

When running sar2html -c to configure, it is looking for sar2ascii.tar and other files in their old locations. Because of this, it does not tune sar2ascii or apply some of the configuration changes.

[root@centos6vm new]# ./sar2html -c
Please enter IP Address of sar2html host [192.168.2.225]:
grep: sar2ascii: No such file or directory
sed: can't read sar2ascii: No such file or directory
Please enter www user: apache
Please enter www group: apache
chown: cannot access `Crypt': No such file or directory
chown: cannot access `File': No such file or directory
chown: cannot access `Math': No such file or directory
chown: cannot access `Net': No such file or directory
sar2html initialized. Now you may open sar2html.php via your browser.

The relevant block of code just needs some new paths specified.

Old block:

    489         tar xvf sar2ascii.tar &> /dev/null
    490         rm -rf sar2ascii.tar
    491         HOST_OLDLINE=`grep SAR2HTML_HOST sarFILES/sar2ascii`
    492         HOST_NEWLINE="SAR2HTML_HOST=$sar2html_hostip"
    493         sed -i "s/$HOST_OLDLINE/$HOST_NEWLINE/g" sar2ascii
    494         tar cvf sar2ascii.tar sar2ascii &> /dev/null
    495         echo -n "Please enter www user: "
    496         read S2_WWWU
    497         echo -n "Please enter www group: "
    498         read S2_WWWG
    499         mkdir -p $SA_LOC/uPLOAD/
    500         chown -R $S2_WWWU:$S2_WWWG $SA_LOC sar2ascii.tar sar2html sar2html.php Crypt File Math Net
    501         echo "sar2html initialized. Now you may open sar2html.php via your browser."

New block, with updated paths and removing the old folders Crypt, Math, Net, etc:

    489         tar xvf sarFILE/ar2ascii.tar &> /dev/null
    490         rm -rf sarFILE/sar2ascii.tar
    491         HOST_OLDLINE=`grep SAR2HTML_HOST sarFILE/sar2ascii`
    492         HOST_NEWLINE="SAR2HTML_HOST=$sar2html_hostip"
    493         sed -i "s/$HOST_OLDLINE/$HOST_NEWLINE/g" sarFILE/sar2ascii
    494         tar cvf sarFILE/sar2ascii.tar sarFILE/sar2ascii &> /dev/null
    495         echo -n "Please enter www user: "
    496         read S2_WWWU
    497         echo -n "Please enter www group: "
    498         read S2_WWWG
    499         mkdir -p $SA_LOC/uPLOAD/
    500         chown -R $S2_WWWU:$S2_WWWG $SA_LOC sarFILE/sar2ascii.tar sar2html sar2html.php
    501         echo "sar2html initialized. Now you may open sar2html.php via your browser."

Compared:

[root@centos6vm sar2html]# diff sar2html.bak sar2html.patched
489,491c489,491
<       tar xvf sar2ascii.tar &> /dev/null
<       rm -rf sar2ascii.tar
<       HOST_OLDLINE=`grep SAR2HTML_HOST sar2ascii`
---
>       tar xvf sarFILE/ar2ascii.tar &> /dev/null
>       rm -rf sarFILE/sar2ascii.tar
>       HOST_OLDLINE=`grep SAR2HTML_HOST sarFILE/sar2ascii`
493,494c493,494
<       sed -i "s/$HOST_OLDLINE/$HOST_NEWLINE/g" sar2ascii
<       tar cvf sar2ascii.tar sar2ascii &> /dev/null
---
>       sed -i "s/$HOST_OLDLINE/$HOST_NEWLINE/g" sarFILE/sar2ascii
>       tar cvf sarFILE/sar2ascii.tar sarFILE/sar2ascii &> /dev/null
500c500
<       chown -R $S2_WWWU:$S2_WWWG $SA_LOC sar2ascii.tar sar2html sar2html.php Crypt File Math Net
---
>       chown -R $S2_WWWU:$S2_WWWG $SA_LOC sarFILE/sar2ascii.tar sar2html sar2html.php
1 Attachments

Discussion

  • d3

    d3 - 2016-02-22

    Forgot to mention: the chown statement on line 500 should also include the new subfolder sarFILE:

    chown -R $S2_WWWU:$S2_WWWG $SA_LOC sarFILE/sar2ascii.tar sar2html sar2html.php sarFILE
    
     
  • CemTan

    CemTan - 2016-02-22
    • status: open --> closed
    • assigned_to: CemTan
     

Log in to post a comment.

MongoDB Logo MongoDB