一、记录一下如何ubuntu server如何查看crontab日志

crontab记录日志

修改rsyslog

sudo vim /etc/rsyslog.d/50-default.conf

cron.* /var/log/cron.log #将cron前面的注释符去掉

重启rsyslog

sudo service rsyslog restart

查看crontab日志

less /var/log/cron.log

二、ubuntu 重设crontab -e的默认编辑器

Ubuntu System Admin 在一线上服务器上设置计划任务, 不小心选择了nano, 由于以前接触的是redhat系列的, 不习惯用nano, 于是想重设下, 网上查了下, 貌似没有。。

无奈之下,重装一台服务器测试, 发现当你第一次crontab -e选择编辑器的时候就会提醒你: 以后若要该改变选择, 输入select-editor 唉,还是不够细心啊。。 sudo select-editor 选择vim 搞定。。

root@ubuntu:/var/www# select-editor

Select an editor. To change later, run 'select-editor'.

1. /bin/ed

2. /bin/nano <---- easiest

3. /usr/bin/vim.basic

4. /usr/bin/vim.tiny

选择的数字是“3”, /usr/bin/vim.basic。

三、ubuntu dash shell 改为 bash

ubuntu shell 下默认的脚本解析器是dash, 会使一些bash脚本执行失败.

通过如下方式改回bash:

sudo dpkg-reconfigure dash

选择NO

四、如何修改resolv.conf

unbuntu每次重启会重置resolv.conf

1.把/etc/network/interfaces文件里的dns-nameservers写入resolv.conf

2.把/etc/resolvconf/resolv.conf.d/base的内容复制到resolv.conf

因此我们要保证每次重启后resolv.conf不变的话我们就要从如上两个文件着手修改

五、如何修改IP

修改如下配置文件即可

cat /etc/network/interfaces

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

auto eth0

iface eth0 inet static

address 192.168.1.100

netmask 255.255.0.0

network 192.168.0.0

broadcast 192.168.255.255

gateway 192.168.1.1

# dns-* options are implemented by the resolvconf package, if installed

dns-nameservers 192.168.0.1

六、修改主机名

修改如下两个文件即可

/etc/hostname

/etc/hosts

点赞(116)

评论列表共有 0 条评论

立即
投稿
返回
顶部