20190304今天學到了什麼 crontab-pem-locale

  1. 用戶的crontab文件在哪裏? 手動輸入命令和crontab執行不同?https://stackoverflow.com/questions/28864842/linux-bash-shell-script-output-is-different-from-cronjob-vs-manually-running-the https://stackoverflow.com/questions/10129381/crontab-path-and-user https://superuser.com/questions/170866/how-to-run-a-cron-job-as-a-specific-user                   針對第一問,當我使用crontab -e編輯時,然後又使用lsof -c /usr/bin/crontab 驚奇地看到crontab編輯的是它自己! ubuntu用戶打開的文件/var/spool/cron/crontabs/ubuntu 怪不得下面也有個/var/spool/cron 但是你vim /usr/bin/crontab也是能看到文本內容的!
    可以在系統級cron文件(在/etc/cron.d/目錄下,放置一個符合cron語法的文件,該文件中可以指定用戶)中名。                                                                      
    man cron man crontab cron是一個守護進程,crontab用來管理不同用戶的定時任務(直接編輯各用戶配置文件)

crontab - maintain crontab files for individual users (Vixie Cron)
crontab is the program used to install, deinstall or list the tables used to drive the cron(8) daemon in Vixie Cron. Each user can have their own crontab, and though these are files in /var/spool/cron/crontabs, they are not intended to be edited directly.

可以使用 ps axef查看每個進程的環境變量

In *ix, processes commonly inherit an environment from their parent process across fork+exec. They have the option of clearing the environment, but usually they don’t. You can see the process tree with ps axf, and you can see the environment variables by using ps axfe.
cron is commonly not a child of someone’s shell, so it’ll often have a different environment from your interactive shell. There’s a good chance cron’s going to be intentionally clearing its own environment somehow for consistency though.
https://stackoverflow.com/questions/10129381/crontab-path-and-user

在這裏插入圖片描述
2. pem文件是什麼東西?登錄ssh時可以使用幾種辦法驗證? https://serverfault.com/questions/9708/what-is-a-pem-file-and-how-does-it-differ-from-other-openssl-generated-key-file https://stackoverflow.com/questions/991758/how-to-get-pem-file-from-key-and-crt-files
3. 語言設置和locales https://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue 這個不管用的話,使用:https://unix.stackexchange.com/questions/87116/what-do-i-need-to-do-with-man-cant-set-the-locale-make-sure-lc-and-lang
4. whereis和which搜索目錄的不同?
which: current environment
>which returns the pathnames of the files (or links) which would be executed in the current environment, had its arguments been given as commands in a strictly
POSIX-conformant shell. It does this by searching the PATH for executable files matching the names of the arguments. It does not follow symbolic links.

where:
 >whereis  locates source/binary and manuals sections for specified files.  The supplied names are first stripped of leading pathname components and any (single)
   trailing extension of the form .ext, for example, .c.  Prefixes of s.  resulting from use of source code control are also dealt with.  whereis then attempts to
   locate the desired program in a list of standard Linux places.

where目錄:
/{bin,sbin,etc}
/usr/{lib,bin,old,new,local,games,include,etc,src,man,sbin, X386,TeX,g++-include}
/usr/local/{X386,TeX,X11,include,lib,man,etc,bin,games,emacs}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章