Want to subscribe to topics you're interested in?
Become a Member

Sysadmin Crontab text become corrupted

Discussion in 'System Administration' started by ahmed, Apr 11, 2017.

  1. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    5:17 AM
    Hello


    whenver I clone or snapshote a VPS

    the text of the restored or the clonned crontab becomes corrupted and contains:

    Code:
    ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@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^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@~ 
    
    is there any clue why this happens?
     
  2. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    5:17 AM
    I use this command to edit the crontab

    Code:
    export VISUAL=nano; crontab -e
    
     
  3. eva2000

    eva2000 Administrator Staff Member

    55,445
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,841
    Local Time:
    1:17 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    haven't seen or heard of such an issue before ! so that's a new one for me

    what SSH client you using ? local PC english or non-english language based ?

    you can use just crontab -e as Centmin Mod sets nano as default editor.

    who's web host ? Google Cloud Compute ? have you asked their tech support if it's a known issue ?
     
  4. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    5:17 AM
    Thanks Eva for quick reply, as usual :)

    yes it is google, I contacted them, if this is not related to centminmod, then it might be related to their zipping/tarring of archives

    I my Mac has Arabic, but English is the primary Lang, but I'm editing only in English


    And when typing
    Code:
    crontab -e
    I don't get nano as an editor please see screenshot
     

    Attached Files:

  5. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    5:17 AM
    is the editor on the snapshot is nano?
    if not, why the default centmin setting is not applied?
     
  6. eva2000

    eva2000 Administrator Staff Member

    55,445
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,841
    Local Time:
    1:17 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Centmin Mod sets nano as default editor in /root/.bash_profile

    you can confirm by checking /root/.bash_profile
    Code (Text):
    grep nano /root/.bash_profile
    export EDITOR=nano
    


    but i can see possibly why it isn't working for you if you web host provide defaults to using a sudo user i.e. Amazon EC2. Google Compute using sudo user or full root by default ?
     
  7. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    5:17 AM
    it showed
    Code:
    export EDITOR=nano
    
    -I go into the server by ssh and then entering "sudo su"
    then the user will be
    [00:55][root@vps
     
  8. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    5:17 AM
    the good news is that Im in touch with one of google engineers, so what is the bug
     
  9. eva2000

    eva2000 Administrator Staff Member

    55,445
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,841
    Local Time:
    1:17 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    but you are ssh login as non-root user first ?
    is a bug ?
     
  10. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    5:17 AM
    google cloud has a special glcoud sdk access first

    gcloud compute --project "name" ssh --zone "us-central1-f" "vps name"
     
  11. eva2000

    eva2000 Administrator Staff Member

    55,445
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,841
    Local Time:
    1:17 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    i see possibly why nano editor isn't getting set then

    what output do you get from this command in ssh immediately after logging in via sdk but BEFORE sudo switch to root
    Code (Text):
    ls -lah ~/.bash_profile
    
     
  12. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    5:17 AM
    this is what I got before root
    Code:
    -rw-r--r--. 1 ahmed ahmed 193 Dec  6 23:19 /home/ahmed/.bash_profile
    
     
  13. eva2000

    eva2000 Administrator Staff Member

    55,445
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,841
    Local Time:
    1:17 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    edit that file and add
    Code (Text):
    export EDITOR=nano

    that sets default editor the next time you ssh in
     
  14. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    5:17 AM
    done, edited the file

    but when clicking crontab -e it opens with the editor i sent its screenshot
     
  15. eva2000

    eva2000 Administrator Staff Member

    55,445
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,841
    Local Time:
    1:17 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    need to log out of ssh and back in for changes to take