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

Sysadmin Yum update shortcut

Discussion in 'System Administration' started by BamaStangGuy, Apr 6, 2017.

  1. BamaStangGuy

    BamaStangGuy Active Member

    470
    137
    43
    May 25, 2014
    Ratings:
    +180
    Local Time:
    7:27 PM
    How can I make a shortcut to this command:

    Code:
    yum update -y --disableplugin=priorities --enablerepo=remi,city-fan.org
    in a similar way that ngxrestart is a shortcut?

    Something like pkgupdate or whatever.
     
  2. Sunka

    Sunka Active Member

    917
    240
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +388
    Local Time:
    2:27 AM
    Nginx 1.13.3
    MariaDB 10.1.24
    Maybe create alias for that?
    Code (Text):
    alias pkgupdate='yum update -y --disableplugin=priorities --enablerepo=remi,city-fan.org'
     
    • Like Like x 1
    • Agree Agree x 1
  3. eva2000

    eva2000 Administrator Staff Member

    30,194
    6,789
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,144
    Local Time:
    10:27 AM
    Nginx 1.13.x
    MariaDB 5.5
    yum cmd aliases

    i.e.
    Code (Text):
    alias
    alias acme.sh='/root/.acme.sh/acme.sh'
    alias cmdir='pushd /usr/local/src/centminmod'
    alias cp='cp -i'
    alias egrep='egrep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias grep='grep --color=auto'
    alias l.='ls -d .* --color=auto'
    alias ll='ls -l --color=auto'
    alias ls='ls --color=auto'
    alias mv='mv -i'
    alias postfixlog='pflogsumm -d today --verbose_msg_detail /var/log/maillog'
    alias pwdh='echo -n "$HOSTNAME"; echo " $PWD"'
    alias rm='rm -i'
    alias top2='glances'
    alias wget='/usr/local/bin/wget'
    alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
     
    • Like Like x 1
    • Informative Informative x 1
  4. BamaStangGuy

    BamaStangGuy Active Member

    470
    137
    43
    May 25, 2014
    Ratings:
    +180
    Local Time:
    7:27 PM
    Will this survive a reboot?
     
  5. eva2000

    eva2000 Administrator Staff Member

    30,194
    6,789
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,144
    Local Time:
    10:27 AM
    Nginx 1.13.x
    MariaDB 5.5
    from linked alias guides, aliases only survive reboots if placed in ~/.bashrc

    i.e. ~/.bashrc
    Code (Text):
    cat ~/.bashrc | grep alias
    # User specific aliases and functions
    alias rm='rm -i'
    alias cp='cp -i'
    alias mv='mv -i'
    alias wget='/usr/local/bin/wget'
    alias pwdh='echo -n "$HOSTNAME"; echo " $PWD"'
    alias postfixlog='pflogsumm -d today --verbose_msg_detail /var/log/maillog'
    alias top2="glances"
    alias cmdir='pushd /usr/local/src/centminmod'
    
     
    • Like Like x 1
    • Informative Informative x 1
  6. BamaStangGuy

    BamaStangGuy Active Member

    470
    137
    43
    May 25, 2014
    Ratings:
    +180
    Local Time:
    7:27 PM
    I guess I am confused on how the ones in CentminMod exist since I can't see them anywhere?
     
  7. eva2000

    eva2000 Administrator Staff Member

    30,194
    6,789
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,144
    Local Time:
    10:27 AM
    Nginx 1.13.x
    MariaDB 5.5
    centmin mod command shortcuts are actual files not aliases :)
    Code (Text):
    cat /usr/bin/ngxrestart
    service nginx restart
     
    • Like Like x 1
  8. Sunka

    Sunka Active Member

    917
    240
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +388
    Local Time:
    2:27 AM
    Nginx 1.13.3
    MariaDB 10.1.24
    just add that command into .bashrc for root user or in user directory (if not root), and like eva said, it will be permanent alias
    Code (Text):
    nano /root/.bashrc

    Code (Text):
    alias pkgupdate='yum update -y --disableplugin=priorities --enablerepo=remi,city-fan.org'
     
    • Informative Informative x 2
    • Like Like x 1
    • Agree Agree x 1
  9. eva2000

    eva2000 Administrator Staff Member

    30,194
    6,789
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,144
    Local Time:
    10:27 AM
    Nginx 1.13.x
    MariaDB 5.5
    with command aliases you can also make shortcuts to command nginx vhost specific tasks i.e.
    Code (Text):
    alias v1conf='nano -w /usr/local/nginx/conf/conf.d/domain.com.conf'
    alias v1sconf='nano -w /usr/local/nginx/conf/conf.d/domain.com.ssl.conf'
    alias v1log='pushd /home/nginx/domains/domain.com/log'
    alias v1pub='pushd /home/nginx/domains/domain.com/public'
    alias v1sdir='pushd /usr/local/nginx/conf/ssl/domain.com'
    

    typing:
    • v1conf invokes nano to edit domain.com.conf vhost file
    • v1sconf invokes nano to edit domain.com.ssl.conf vhost file
    • v1log changes to domain.com's log directory
    • v1pub changes to domain.com web root at public
    • v1sdir changes to domain.com's ssl/domain.com directory containing ssl cert files
     
    • Like Like x 1