Cron running script to check line for a comment

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












WE are running plesk on Centos 7 and need to check this config file every 5 minutes to make sure that line x is commented out as plesk keeps un commenting it.
We would run this under cron every 5 minutes...



the file path is
/etc/proftpd.d/50-plesk.conf



the line we wish to make sure is always commented is...



MasqueradeAddress 37.***.4***.60

-----------------------------------
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

# Global section
<Global>
<IfModule mod_tls.c>
TLSEngine on
TLSRequired off
</IfModule>
</Global>
# Global section
<VirtualHost 10.***.***.195>
#MasqueradeAddress 37.***.4***.60











share|improve this question



















  • 3




    You should find out why plesk keeps adding the line and fix that.
    – RalfFriedl
    Aug 15 at 10:20






  • 2




    If you discover the line uncommented, would you also have to restart any services that might now be running “incorrectly”?
    – Jeff Schaller
    Aug 15 at 10:40










  • Here is a possible answer about searching and replacing things inside a file, but as @RalfFriedl suggested you should find what is doing this in the first place. askubuntu.com/questions/20414/…
    – Mehmet
    Aug 15 at 11:05










  • Thanks, Plesk support say that there is no way around this and this is the only way.....
    – SnowPlough
    Aug 15 at 11:16














up vote
0
down vote

favorite












WE are running plesk on Centos 7 and need to check this config file every 5 minutes to make sure that line x is commented out as plesk keeps un commenting it.
We would run this under cron every 5 minutes...



the file path is
/etc/proftpd.d/50-plesk.conf



the line we wish to make sure is always commented is...



MasqueradeAddress 37.***.4***.60

-----------------------------------
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

# Global section
<Global>
<IfModule mod_tls.c>
TLSEngine on
TLSRequired off
</IfModule>
</Global>
# Global section
<VirtualHost 10.***.***.195>
#MasqueradeAddress 37.***.4***.60











share|improve this question



















  • 3




    You should find out why plesk keeps adding the line and fix that.
    – RalfFriedl
    Aug 15 at 10:20






  • 2




    If you discover the line uncommented, would you also have to restart any services that might now be running “incorrectly”?
    – Jeff Schaller
    Aug 15 at 10:40










  • Here is a possible answer about searching and replacing things inside a file, but as @RalfFriedl suggested you should find what is doing this in the first place. askubuntu.com/questions/20414/…
    – Mehmet
    Aug 15 at 11:05










  • Thanks, Plesk support say that there is no way around this and this is the only way.....
    – SnowPlough
    Aug 15 at 11:16












up vote
0
down vote

favorite









up vote
0
down vote

favorite











WE are running plesk on Centos 7 and need to check this config file every 5 minutes to make sure that line x is commented out as plesk keeps un commenting it.
We would run this under cron every 5 minutes...



the file path is
/etc/proftpd.d/50-plesk.conf



the line we wish to make sure is always commented is...



MasqueradeAddress 37.***.4***.60

-----------------------------------
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

# Global section
<Global>
<IfModule mod_tls.c>
TLSEngine on
TLSRequired off
</IfModule>
</Global>
# Global section
<VirtualHost 10.***.***.195>
#MasqueradeAddress 37.***.4***.60











share|improve this question















WE are running plesk on Centos 7 and need to check this config file every 5 minutes to make sure that line x is commented out as plesk keeps un commenting it.
We would run this under cron every 5 minutes...



the file path is
/etc/proftpd.d/50-plesk.conf



the line we wish to make sure is always commented is...



MasqueradeAddress 37.***.4***.60

-----------------------------------
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

# Global section
<Global>
<IfModule mod_tls.c>
TLSEngine on
TLSRequired off
</IfModule>
</Global>
# Global section
<VirtualHost 10.***.***.195>
#MasqueradeAddress 37.***.4***.60








scripting cron






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 15 at 11:50









Rui F Ribeiro

36.7k1271116




36.7k1271116










asked Aug 15 at 10:14









SnowPlough

6




6







  • 3




    You should find out why plesk keeps adding the line and fix that.
    – RalfFriedl
    Aug 15 at 10:20






  • 2




    If you discover the line uncommented, would you also have to restart any services that might now be running “incorrectly”?
    – Jeff Schaller
    Aug 15 at 10:40










  • Here is a possible answer about searching and replacing things inside a file, but as @RalfFriedl suggested you should find what is doing this in the first place. askubuntu.com/questions/20414/…
    – Mehmet
    Aug 15 at 11:05










  • Thanks, Plesk support say that there is no way around this and this is the only way.....
    – SnowPlough
    Aug 15 at 11:16












  • 3




    You should find out why plesk keeps adding the line and fix that.
    – RalfFriedl
    Aug 15 at 10:20






  • 2




    If you discover the line uncommented, would you also have to restart any services that might now be running “incorrectly”?
    – Jeff Schaller
    Aug 15 at 10:40










  • Here is a possible answer about searching and replacing things inside a file, but as @RalfFriedl suggested you should find what is doing this in the first place. askubuntu.com/questions/20414/…
    – Mehmet
    Aug 15 at 11:05










  • Thanks, Plesk support say that there is no way around this and this is the only way.....
    – SnowPlough
    Aug 15 at 11:16







3




3




You should find out why plesk keeps adding the line and fix that.
– RalfFriedl
Aug 15 at 10:20




You should find out why plesk keeps adding the line and fix that.
– RalfFriedl
Aug 15 at 10:20




2




2




If you discover the line uncommented, would you also have to restart any services that might now be running “incorrectly”?
– Jeff Schaller
Aug 15 at 10:40




If you discover the line uncommented, would you also have to restart any services that might now be running “incorrectly”?
– Jeff Schaller
Aug 15 at 10:40












Here is a possible answer about searching and replacing things inside a file, but as @RalfFriedl suggested you should find what is doing this in the first place. askubuntu.com/questions/20414/…
– Mehmet
Aug 15 at 11:05




Here is a possible answer about searching and replacing things inside a file, but as @RalfFriedl suggested you should find what is doing this in the first place. askubuntu.com/questions/20414/…
– Mehmet
Aug 15 at 11:05












Thanks, Plesk support say that there is no way around this and this is the only way.....
– SnowPlough
Aug 15 at 11:16




Thanks, Plesk support say that there is no way around this and this is the only way.....
– SnowPlough
Aug 15 at 11:16










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Instead of a cron job, as a short time measure, tell the OS to write protect that file.



Do:



sudo chattr +i /etc/proftpd.d/50-plesk.conf


Obviously, as the comments rightfully tell you, the duty of Plesk Support would be to tell you how to solve that, or give you a software fix.






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f462717%2fcron-running-script-to-check-line-for-a-comment%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Instead of a cron job, as a short time measure, tell the OS to write protect that file.



    Do:



    sudo chattr +i /etc/proftpd.d/50-plesk.conf


    Obviously, as the comments rightfully tell you, the duty of Plesk Support would be to tell you how to solve that, or give you a software fix.






    share|improve this answer
























      up vote
      0
      down vote













      Instead of a cron job, as a short time measure, tell the OS to write protect that file.



      Do:



      sudo chattr +i /etc/proftpd.d/50-plesk.conf


      Obviously, as the comments rightfully tell you, the duty of Plesk Support would be to tell you how to solve that, or give you a software fix.






      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        Instead of a cron job, as a short time measure, tell the OS to write protect that file.



        Do:



        sudo chattr +i /etc/proftpd.d/50-plesk.conf


        Obviously, as the comments rightfully tell you, the duty of Plesk Support would be to tell you how to solve that, or give you a software fix.






        share|improve this answer












        Instead of a cron job, as a short time measure, tell the OS to write protect that file.



        Do:



        sudo chattr +i /etc/proftpd.d/50-plesk.conf


        Obviously, as the comments rightfully tell you, the duty of Plesk Support would be to tell you how to solve that, or give you a software fix.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 15 at 11:49









        Rui F Ribeiro

        36.7k1271116




        36.7k1271116



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f462717%2fcron-running-script-to-check-line-for-a-comment%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?