Learn about Centmin Mod LEMP Stack today
Become a Member

crontab -e

Discussion in 'System Administration' started by Itworx4me, Feb 16, 2025.

  1. Itworx4me

    Itworx4me Active Member

    316
    29
    28
    Mar 14, 2017
    Ratings:
    +52
    Local Time:
    12:07 PM
    Nginx 1.27.4
    MariaDB 10.6.21
    When running the crontab -e it won't allow me to add any lines of code. I ran into this problem before but can't seem to remember the fix. Can someone point me in the right direction?


    Thanks,
    Itworx4me
     
  2. brijendrasial

    brijendrasial Active Member

    208
    154
    43
    Mar 21, 2018
    Ratings:
    +236
    Local Time:
    12:37 AM
    1.13.9
    10.0.22-MariaDB
    out if output of crontab -l
     
  3. Itworx4me

    Itworx4me Active Member

    316
    29
    28
    Mar 14, 2017
    Ratings:
    +52
    Local Time:
    12:07 PM
    Nginx 1.27.4
    MariaDB 10.6.21
    All this does is list what's in the crontab.
     
  4. Itworx4me

    Itworx4me Active Member

    316
    29
    28
    Mar 14, 2017
    Ratings:
    +52
    Local Time:
    12:07 PM
    Nginx 1.27.4
    MariaDB 10.6.21
    Here is the solution if anyone runs into this issue as I am a newbie when it comes to command line commands.

    To edit the crontab run this command:
    Code (Text):
    crontab -e

    From there hit the I on the keyboard to insert new command.
    Type new entry
    To exit hit the esc button followed by this code:
    Code (Text):
    :wq!

    Hope this help with anyone having the issue of editing the crontab.

    Itworx4me
     
  5. MaximilianKohler

    MaximilianKohler Member

    201
    7
    18
    Jun 23, 2023
    Ratings:
    +34
    Local Time:
    12:07 PM
    That might be due to the default/current text editor. I remember having a similar problem with one of the editors. Nano is the one that has been the most intuitive for me. I may have had to set it as default on one of these OS's.
     
  6. eva2000

    eva2000 Administrator Staff Member

    54,864
    12,239
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,810
    Local Time:
    5:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yeah depends on editor used, Centmin Mod should actually default to nano but your commands that worked are for vim/vi. I think might be a bug in Centmin Mod not setting it to nano by default will check

    What does your contents show /root/.bash_profile
    Code (Text):
    cat /root/.bash_profile
    


    Easiest way to edit configuration or any files on your server is via logging into your server via ssh and directly editing them using nano or vim linux text editors.

    For nano which you can read up more about nano here or here or here. For vim text editor read here and here and thread at WebPerf - Popular Vim Commands – a Comprehensive Vim Cheatsheet

    Also there's numerous online how to use guides for nano and vim you can search for via google :)
     
  7. eva2000

    eva2000 Administrator Staff Member

    54,864
    12,239
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,810
    Local Time:
    5:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yup it's a bug. I've updated 140.00beta01 with fix and also released a new stable from 131.00stable to 132.00stable release which has the fix and major change to default new installs on EL8 to MariaDB 10.6 LTS instead of MariaDB 10.4.

    so to update for 140.00beta01, run cmupdate and run and exit centmin.sh once

    for stable branch, run cmupdate, then cmupdate update-stable to get 132.00stable and run and exit centmin.sh once
     
  8. Itworx4me

    Itworx4me Active Member

    316
    29
    28
    Mar 14, 2017
    Ratings:
    +52
    Local Time:
    12:07 PM
    Nginx 1.27.4
    MariaDB 10.6.21
    What does your contents show /root/.bash_profile
    Code (Text):
    cat /root/.bash_profile
    

    Code (Text):
    # .bash_profile
    
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    
    # User specific environment and startup programs

    I am running the latest 140.00beta01 and still have to use my solution above to make any edits to crontab -e.

    Thanks,
    Itworx4me
     
  9. eva2000

    eva2000 Administrator Staff Member

    54,864
    12,239
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,810
    Local Time:
    5:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    this https://community.centminmod.com/threads/crontab-e.27479/#post-103275 should fix it ;)
     
  10. Itworx4me

    Itworx4me Active Member

    316
    29
    28
    Mar 14, 2017
    Ratings:
    +52
    Local Time:
    12:07 PM
    Nginx 1.27.4
    MariaDB 10.6.21
  11. eva2000

    eva2000 Administrator Staff Member

    54,864
    12,239
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,810
    Local Time:
    5:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Forgot to mention you need to logout and back into your SSH session for changes to take effect or run command one time in same existing SSH session
    Code (Text):
    source /root/.bash_profile