Linux/Ubuntu2018. 12. 6. 15:17

좀 귀찮게 먼가 콘솔로 치던가 다른 유틸로 만들던가..

탐색기에서 만드는 법은 없나...?


[링크 : https://linuxconfig.org/how-to-create-desktop-shortcut-launcher-on-ubuntu-18-04-bionic-beaver-linux]

'Linux > Ubuntu' 카테고리의 다른 글

lpstat  (0) 2018.12.18
lp lpr  (0) 2018.12.18
do-release-upgrade와 apt-get dist-upgrade  (0) 2018.09.28
tmux  (0) 2018.08.13
우분투 자동 업데이트  (0) 2018.05.21
Posted by 구차니
Linux/centos2018. 12. 3. 17:13

_

2019.03.21

centos7 기준 아래 경로가 잘못되어 수정

# vi /usr/lib/systemd/system/servicename




# vi /usr/lib/systemd/service/servicename

[Unit]

Description = making network connection up

After = network.target


[Service]

ExecStart = /root/scripts/conup.sh


[Install]

WantedBy = multi-user.target


실제 서비스 등록

# chmod +x /root/scripts/conup.sh

# systemctl enable servicename  


[링크 : https://www.tecmint.com/create-new-service-units-in-systemd/]



+

node.js 경로줘서 실행하기


npm start --prefix path/to/your/app 


[링크 : https://stackoverflow.com/questions/36172442/how-to-npm-start-at-a-different-directory]


+

귀찮으니.. whereis로 찾아서

/bin/http-server 와(얘는 걍 스크립트)

/bin/node 를 만들어 주면 해결!(얘는 바이너리)

[링크 : http://leechwin.tistory.com/...usrbinenv-node-No-such-file-or-directory-에러가-발생하는-경우]



+

reload를 적용하려면 아래의 줄을 [service] 항목에 추가하면 되는 듯?

[Unit]

Description=The NGINX HTTP and reverse proxy server

After=syslog.target network.target remote-fs.target nss-lookup.target


[Service]

Type=forking

PIDFile=/run/nginx.pid

ExecStartPre=/usr/sbin/nginx -t

ExecStart=/usr/sbin/nginx

ExecReload=/bin/kill -s HUP $MAINPID

ExecStop=/bin/kill -s QUIT $MAINPID

PrivateTmp=true


[Install]

WantedBy=multi-user.target 


[링크 : https://www.shellhacks.com/systemd-service-file-example/]

Posted by 구차니
Linux/centos2018. 11. 16. 17:49

아래와 같이 하니 등록은 되는 듯?


# systemctl enable mariadb

Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.


# systemctl enable httpd

Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. 


[링크 : https://www.liquidweb.com/kb/how-to-install-mysql-mariadb-on-centos-7/]

[링크 : http://blog.andrewc.com/2016/06/autostart-apache-on-centos-7-boot/]

Posted by 구차니
Linux2018. 11. 12. 15:55

optarg의 경우 루프를 돌고 나면 리셋 되기 때문에

해당 옵션 판별시 다른 변수로 반드시 저장을 해주어야 한다.

그렇지 않으면 '(null)' 이라는 문자열이 돌아온다.


[링크 : https://soooprmx.com/archives/4993]

[링크 : https://linux.die.net/man/3/getopt]

[링크 : https://www.gnu.org/software/libc/manual/html_node/Example-of-Getopt.html]

'Linux' 카테고리의 다른 글

bash builtin 명령어 .  (0) 2019.01.28
네트워크 인터페이스 명칭이 이상하다? enp0s0? em0?  (0) 2019.01.23
mount -o codepage=cp949  (0) 2018.01.04
taint kernel?  (0) 2017.12.03
limits.conf와 ulimit  (0) 2017.08.24
Posted by 구차니
Linux/Ubuntu2018. 9. 28. 06:59

'Linux > Ubuntu' 카테고리의 다른 글

lp lpr  (0) 2018.12.18
ubuntu desktop shortcut  (0) 2018.12.06
tmux  (0) 2018.08.13
우분투 자동 업데이트  (0) 2018.05.21
E: /var/lib/dpkg/lock 잠금 파일을 얻을 수 없습니다  (0) 2018.05.17
Posted by 구차니
Linux/centos2018. 9. 12. 12:53

mobaxterm으로 centos 새로 설치한거에  접속해서 gvim을 테스트 삼아 실행하는데 에러!

디스플레이가 없습니다 라고 배를 짼다.


yum install xorg-x11-xauth xorg-x11-fonts-* xorg-x11-font-utils xorg-x11-fonts-Type1 

[링크 : https://itekblog.com/ssh-x11-forwarding-display-using-mobaxterm/]

[링크 : https://stackoverflow.com/questions/40746146/how-does-mobaxterm-know-whether-x11-forwarding-is-working-on-remote-server]


그래서 찾아보니 /etc/ssh/sshd 설정도 문제가 아닌데 하고 갸우뚱 하면서 패키지 설치하고

mobaxterm 세션을 끊었다가 다시 시작하니 아래와 같이 나오면서 잘 된다!


     ┌────────────────────────────────────────────────────────────────────┐


     │                        • MobaXterm 10.9 •                          │


     │            (SSH client, X-server and networking tools)             │


     │                                                                    │


     │ ➤ SSH session to root@0.0.0.0                                      │


     │   • SSH compression : ✔                                            │


     │   • SSH-browser     : ✔                                            │


     │   • X11-forwarding  : ✔  (remote display is forwarded through SSH) │


     │   • DISPLAY         : ✔  (automatically set on remote server)      │


     │                                                                    │


     │ ➤ For more info, ctrl+click on help or visit our website           │


     └────────────────────────────────────────────────────────────────────┘




mobaxterm의 xorg-x11-xauth 특성 때문인가?

'Linux > centos' 카테고리의 다른 글

KVM spice 원격 접속시 No route to host  (0) 2019.01.28
yum checkupdate  (0) 2019.01.25
centos 서비스 등록하기  (0) 2018.12.03
centos 서비스 자동시작  (0) 2018.11.16
node.js centos에 설치하기  (0) 2018.09.11
Posted by 구차니
Linux/centos2018. 9. 11. 15:48

췟.. 귀찮네 -_ㅠ


curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -

sudo yum -y install nodejs

yum install gcc-c++ make 

[링크 : https://nodejs.org/ko/download/package-manager/]

'Linux > centos' 카테고리의 다른 글

KVM spice 원격 접속시 No route to host  (0) 2019.01.28
yum checkupdate  (0) 2019.01.25
centos 서비스 등록하기  (0) 2018.12.03
centos 서비스 자동시작  (0) 2018.11.16
mobaxterm - centos 에서 X11 포워딩 안되는 경우 해결책  (0) 2018.09.12
Posted by 구차니
Linux/Ubuntu2018. 8. 13. 14:45
Posted by 구차니
Linux/Ubuntu2018. 5. 21. 10:49

cron-apt 패키지를 통해 특정 주기/시간에 업데이트가 가능하다고 한다.

문제는 apt-get upgrade -y로

확인없이 무조건 업데이트를 하는데 그걸 자동화 해도 되냐는 정도?


#!/bin/bash

apt-get update

apt-get upgrade -y

apt-get autoclean 

[링크 : https://help.ubuntu.com/community/AutoWeeklyUpdateHowTo]

'Linux > Ubuntu' 카테고리의 다른 글

do-release-upgrade와 apt-get dist-upgrade  (0) 2018.09.28
tmux  (0) 2018.08.13
E: /var/lib/dpkg/lock 잠금 파일을 얻을 수 없습니다  (0) 2018.05.17
apt-mark 사용자가 수동으로 설치한 패키지 목록  (0) 2018.05.08
powertop  (0) 2018.05.04
Posted by 구차니
Linux/Ubuntu2018. 5. 17. 22:04

부팅하고 나서 바로 업데이트 하거나 설치하려고 하면

dpkg/lock 잠금 파일을 얻을 수 없다고 배째는데

apt나 dpkg로 프로세스 검색해서 죽여도 안되는 경우가 많다.


간단한(?) 해결책으로야 해당 프로세스 죽인후 lock 파일을 삭제하고 진행하는 것인데

$ sudo apt-get update; sudo apt-get upgrade

기존:1 http://ppa.launchpad.net/saiarcot895/myppa/ubuntu xenial InRelease

기존:2 http://ports.ubuntu.com/ubuntu-ports xenial InRelease

기존:3 http://ports.ubuntu.com/ubuntu-ports xenial-updates InRelease

기존:4 http://ports.ubuntu.com/ubuntu-ports xenial-backports InRelease

기존:5 http://ports.ubuntu.com/ubuntu-ports xenial-security InRelease

패키지 목록을 읽는 중입니다... 완료

E: /var/lib/dpkg/lock 잠금 파일을 얻을 수 없습니다 - open (11: Resource temporarily unavailable)

E: 관리 디렉터리를 (/var/lib/dpkg/) 잠글 수 없습니다. 다른 프로세스가 사용하고 있지 않습니까? 


근본적으로는 그에 연관되는 apt.systemd.daily가 문제라고 보여진다.

~$ ps -ef | grep apt

root      2471     1  0 12:42 ?        00:00:00 /bin/sh /usr/lib/apt/apt.systemd.daily update

root      2475  2471  0 12:42 ?        00:00:00 /bin/sh /usr/lib/apt/apt.systemd.daily lock_is_held update

root      3743     1  0 12:45 ?        00:00:00 /bin/sh /usr/lib/apt/apt.systemd.daily install


아무튼 검색을 해보니 아래 명령을 통해서 죽여 놓을 수 있고

$ sudo systemctl stop apt-daily.timer

$ sudo systemctl disable apt-daily.timer

$ sudo systemctl mask apt-daily.service

$ sudo systemctl daemon-reload 


추가로 아래의 파일을 삭제해주면 완벽! 인가?

/usr/lib/apt/apt.systemd.daily 


그리고 저번에 찾았던 를 통해 주기적인 업데이트를 막아 둘 수 있다.

$ sudo vi /etc/apt/apt.conf.d/10periodic

APT::Periodic::Enable "0";


그 외에는  cloud-init 스크립트를 통해서 apt-daily.service가 불려지니 could-init도 같이 죽이는게 나으려나?

Systemd is all about concurrent start of services, so the cloud-init script is run at the same time the apt-daily.service is triggered. By the time cloud-init gets to execute the user-specified payload, apt-get update is already running. So the attempts 2. and 3. failed not because of some namespace magic, but because they altered the system too late for apt.systemd.daily to pick the changes up.


This also means that there is basically no way of preventing apt.systemd.daily from running -- one can only kill it after it's started. 


[링크 : https://unix.stackexchange.com/.../how-to-disable-apt-daily-service-on-ubuntu-cloud-vm-image]

'Linux > Ubuntu' 카테고리의 다른 글

tmux  (0) 2018.08.13
우분투 자동 업데이트  (0) 2018.05.21
apt-mark 사용자가 수동으로 설치한 패키지 목록  (0) 2018.05.08
powertop  (0) 2018.05.04
ubuntu auto update 끄기  (0) 2018.04.19
Posted by 구차니