Learn about Centmin Mod LEMP Stack today
Become a Member

Sysadmin Crontab text become corrupted

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

  1. ahmed

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    8:25 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 Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    8:25 AM
    I use this command to edit the crontab

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

    eva2000 Administrator Staff Member

    30,170
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,138
    Local Time:
    4:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    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 Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    8:25 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 Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    8:25 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

    30,170
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,138
    Local Time:
    4:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    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 Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    8:25 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 Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    8:25 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

    30,170
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,138
    Local Time:
    4:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    but you are ssh login as non-root user first ?
    is a bug ?
     
  10. ahmed

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    8:25 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

    30,170
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,138
    Local Time:
    4:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    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 Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    8:25 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

    30,170
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,138
    Local Time:
    4:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    edit that file and add
    Code (Text):
    export EDITOR=nano

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

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    8:25 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

    30,170
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,138
    Local Time:
    4:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    need to log out of ssh and back in for changes to take