怎么查看linux server time

怎么查看linux server time,第1张

服务时间也就是大约的开机时间吧,这个方法太多了:
1:
who
命令查看
who
-b
查看最后一次系统启动的时间。
who
-r
查看当前系统运行时间
2:
last
reboot
如下所示last
reboot可以看到Linux系统历史启动的时间。
3:TOP命令查看
up后表示系统到目前运行了多久时间。反过来推算系统重启时间
4:
w命令查看
up后表示系统到目前运行了多久时间。反过来推算系统重启时间
5、uptime
命令查看
6、cat
/proc/uptime
直接查看。

Table 'v9_admin' is read only
表 'v9_admin' 处于只读状态
其实这样的问题,一般都是备份数据库的时候没有按照正常的方法备份。直接在MYSQL DATA目录下面复制的数据,然后上传到新服务器上。造成数据库的权限或者属主不正确导致的。
登陆客户的SSH,进入网站MYSQL下面,修改网站数据库的属主和权限。
运行命令:
chown -R mysql:mysql /var/lib/mysql/juxian/
chmod -R 0777 /var/lib/mysql/juxian/
给数据库目录的所属用户和组改为mysql,并加上777的权限。
然后,运行命令:
cd /var/lib/mysql/bin/
mysqladmin -u root -p flush-tables
运行flush-tables后,刷新网站,看看是不是已经好啦,read only问题解决 。

腐蚀 RUST游戏指令和服务器指令一览,在服务器中,管理员也可以利用指令来管理游戏中不正当行为。下面就给大家带来腐蚀RUST基本指令及服务器指令大全,以供玩家们参考。

基本指令

(以下在聊天框内输入)

/msgmessage a specified player(私信一个玩家)

/mePuts your text into a purple color(你的 文字 将以紫色发出)

(以下在控制台内输入,按F1)

grasson true/false Enables or disables grass; Improves FPS for some(打开/关闭草地,可提高FPS)

grassdisplacement true/false Enables or disables grass displacements(打开关闭草地 移动 )

terrainidleinterval 0-100 Sets how often to draw unseen terrain; setting to 0 will disable(远景更新平率,0为不允许)

guishow Turns the UI on(显示用户界面)

guihide Turns the UI off(关闭用户界面)

guishow_branding Turns the branding UI in top-right corner on(显示右上角的标识)

guihide_branding Turns the branding UI in top-right corner off(隐藏右上角的标识)

netconnect "Server IP" Connect to a direct server IP(连接服务器IP,Server IP出填写服务器的IP)

netdisconnect Disconnects from a server(断开服务器连接)

netreconnect Reconnect to the last server you were on(重新连接上一个服务器)

censornudity false Disabled censorship(关闭裸体)

suicide Kills your character allowing for a respawn(自杀)

quit Quits the game(退出游戏)

服务器指令

rconlogin "password" Use your 'Password' to login into Rcon via ingame console (F1)。(使用控制台登录服务器)

status See how many players are online on server(查看在线玩家数量)

noticepopupall "message" Pops up a message for all players(发送服务器公告,在每个玩家屏幕上d出)

find Lists available console commands(列出控制台指令)

kick "player" Kicks player from the server(踢出某个玩家)

ban "player" or "steamid" Bans player Doesn't kick him though(封掉一个玩家)

banid "steamid" "reason" Bans a steamid from the server(封掉一个玩家的steamID,reason处可写理由,挂狗和无(B)素(I)质(U)狗去死吧)

unbanall Unbans all players(解封所有玩家)

truthenforce true/false Server kicks people automatically when they are doing "weird" things(服务器自动踢出做奇怪事情的人,如卡BUG)

saveall Saves world map and player inventory(服务器保存当前地图和玩家信息)。

say [message] Sends a message to the person/s in-game globally(以服务器身份说话)

invgiveplayer "player" "item" "amount" Gives 'Player' the 'Item' Full name and Item name required List of Items(给玩家东西,“玩家”“物品”“数量”)

invgiveall "item" "amount" Gives all players 'Item' Full Item name required List of Items(给所有人东西,“玩家”“物品”“数量”,比如节日的时候,可以作为惊喜,没人给一把q什么的)

dmggodmode true/false Gives all logged in admins godmode(开启/关闭所有人 创造 模式)

craftingcancel Cancels every single crafting job in progress for everyone(取消制作任何东西)

craftinginstant true/false Sets crafting to be instant for everyone(开启/关闭瞬间制作)

craftinginstant_admins true/false Sets crafting to be instant for logged in admins only(开启/关闭管理员瞬间制作)

craftingtimescale "amount" Sets the timescale of crafting to 'amount' (1 = default, 05 = half time)。(设置制作物品时间的速度,1为默认,05为一半时间)

airdropdrop Starts an airdrop(进行一次物品空降)

airdropmin_players "amount" Starts airdrops only when minimum X players are online(开始物品空降,当在线人数至少“X”人的时候)

vehiclespawn Spawns a car at your current position( 放置 一辆车,在你当前位置,管理装B专用)

serverhostname Sets a hostname(设置服务器名称)

serverclienttimeout "time"Sets the time until someone times out Good to fight item glitchers (Default 2 minutes)(设置超时时长,默认为2分钟)

serverpvp true/false Sets PVP on or off(开启PVP)

servermaxplayers "amount" Sets maximum amount of server slots(设置最大玩家数量)

sleeperson true/false Sets sleepers on or off(是否允许睡眠模式)

envtime "amount" Sets the time of day to a specified value(设置天的时间)

falldamageenabled true/false Turns fall damage on or off(开启/关闭掉落伤害)

RUST++ MOD

(以下在聊天框内输入)

基本命令

/share playername shares your doors with a player(共享你的门给一个玩家)

/unshare playername unshares your doors with a player(解除对一个玩家的门共享)

/help Shows commands(显示所有指令)

/pm "playername" "message" private messages a player(私聊一个玩家,名字必须写全)

/r message here quick reply to last PM(快速回复上一个私聊你的玩家)

/history Shows chat history, last 6 messages by default(显示前6个聊天内容)

/players Shows online players(显示当前在线玩家)

/location Shows the coordinates of the player(显示玩家的当前坐标)

/ping shows latency between client and server(显示服务器的延迟)

/starter gives a configurable starter kit(给予初始装备)

/friends shows your friends list(显示朋友列表)

/addfriend playername adds a player to your friends list(添加一个玩家为好友)

/unfriend playername removes a friend(移除一个好友)

/about shows server mod version(显示服务器版本)

管理员命令

/announce message here ADMIN ONLY - announces a message to the server(发送服务器公告)

/loadout ADMIN ONLY - spawns you an admin loadout set in the config file(生成一个管理 *** 作记录在设置文件夹下)

RustEssentials MOD

(以下在聊天框内输入)

/access {on} (Gives the sender access to all doors,给予你打开所有门的权限)

/access {off} (Revokes access to all doors from the sender,移除你打开所有门的权限)

/airdrop (Spawns an airdrop with a random drop location,设置一次随地地点的空降)

/airdrop(Spawns an airdrop with a drop location at the specified player,设置一次空降给某个玩家)

/ban(Bans player with reason: "Banned by a(n)",封掉一个玩家)

/ban[reason] (Bans player with reason,封掉一个玩家和愿意)

/chan {g} (Joins the global chat,加入全球聊天屏道)

/chan {global} (Joins the global chat,同上)

/chan {d} (Joins the direct chat,加入一个特定聊天屏道)

/chan {direct} (Joins the direct chat,同上)

/give(Gives the item to that player,给一个玩家指定物品)

/give[amount] (Gives the amount of the item to that player,给一个玩家指定物品和数量)

/give[item id] (Gives 1 of the item with the corresponding id to that player,给一个玩家指定的物品,这里用的是物品ID)

/give[item id] [amount] (Gives the amount of the item with the corresponding id to that player,给一个玩家指定的物品和数量,这里用的是物品ID)

/god(Gives the specified player god mode,给指定玩家上帝模式)

/heal player name (Heals the designated player,恢复指定玩家的血)

/help (Returns available commands for your current rank,显示指令)

/help [command without /] (Returns the documentation and syntax for the specified command,显示已经排除外的指令,without/后面填上你不想显示的指令)

/history {1-50} (Returns the the last # lines of the chat history,查看聊天记录,1-50里面填你想查看前面多少条记录)

/i(Gives the item to you,给自己指定物品)

/i[amount] (Gives the amount of the item to you,给自己指定物品和数量)

/i [item id] (Gives 1 of the item with the corresponding id to you,给自己指定物品,这里用的是物品ID)

/i [item id] [amount] (Gives the amount of the item with the corresponding id to you,给自己指定物品和数量,这里用的是物品ID)

/join (Emulates the joining of yourself, 模拟 自己加入游戏)

/join(Emulates the joining of a fake player,加入一个机器人到游戏中)

/kick(Kick player with reason: "Kicked by a(n)",踢出一个玩家)

/kick[reason] (Kick player with reason,踢出一个玩家和愿意)

/kickall (Kicks all users, except for the command executor, out of the server踢出所有玩家,除了输入这条指令者)

/kill(Kills the specified player,杀死一个指定玩家)

/kit [kit name] (Gives the user the specified kit if the user has the correct authority level,给一个用户指定套装,当这个玩家有指定的权限的时候)

/kits (Lists the kits available to you,列出自己所有能用的套装)

/leave (Emulates the leaving of yourself,模拟自己离开游戏)

/leave(Emulates the leaving of a fake player,模拟一个机器人离开游戏)

/mute(Mutes the player on global chat,禁言一个玩家)

/online (Returns the amount of players currently connected,显示所有服务器在线玩家)

/pmmessage (Sends a private message to that player,私聊某个玩家)

/pos (Returns the player's position,显示玩家所在的坐标)

/reload {config/whitelist/ranks/commands/kits/motd/bans/all} (Reloads the specified file,重新加载指定的文件)

/save (Saves all world data,保存世界数据)

/say message (Says a message through the plugin,以服务器身份说话,在公屏上)

/saypop message (Says a (!) dropdown message to all clients,d出一段话,在玩家屏幕上)

/saypop [icon] message (Says a dropdown message to all clients with designated icon),以icon的什么d出一段话,在玩家屏幕上

/share player name (Shares ownership of your doors with the designated user,共享门给指定玩家)

/stop (Saves, deactivates, and effectively stops the server,停止服务器并保存)

/time (Returns current time of day,显示当前世界时间)

/time {0-24} (Sets time to a number between 0 and 24,设置当前世界时间)

/time {day} (Sets time to day,设置为白天)

/time {freeze} (Freezes time,冻住当前时间)

/time {night} (Sets time to night,设置为晚上)

/time {unfreeze} (Unfreezes time,解冻当前时间)

/timescale (Returns the speed at which time passes,显示当前时间流逝速度)

/timescale [#] (Sets the speed at which time passes Recommended between 0 and 1 WARNING: THIS AFFECTS AIRDROPS,设置时间流逝速度,在0和1之间,警告!这个将影响到空降时间)

/uid (Returns your steam UID,显示你的steamID)

/uid player name (Returns that user's steam UID,显示指定玩家的steamID)

/unban(Unbans the specified player,解封指定玩家)

/ungod(Revokes god mode from the specified player,解除指定玩家的上帝模式)

/unmute(Unmutes the player on global chat,解除指定玩家的禁言)

/unshare {all} (Revokes ownership of your doors from everyone,解除对所有玩家的门共享)

/unshare player name(Revokes ownership of your doors from the designated user,解除对指定玩家的门共享)

/version (Returns the current running version of Rust Essentials,重置Rust Essentials模组的版本)

/whitelist {add} [UID] (Adds the specified Steam UID to the whitelist,把指定steamID添加至白名单)

/whitelist {check} (Checks if you're currently on the whitelist,查询白名单)

/whitelist {kick} (Kicks all players that are not whitelisted This only work if whitelist is enabled,踢出所有在白名单的人,如果白名单已经启动)

/whitelist {off} (Turns whitelist off,关掉白名单)

/whitelist {on} (Turns whitelist on,打开白名单)

/whitelist {rem} [UID] (Removes the specified Steam UID to the whitelist,移除指定steamID从白名单)

1、sys_connect

对于客户端来说,当创建了一个套接字后,就可以连接它了。
case SYS_CONNECT:
err = sys_connect(a0, (struct sockaddr __user )a1, a[2]);
break;[/code]

asmlinkage long sys_connect(int fd, struct sockaddr __user uservaddr, int addrlen)
{
struct socket sock;
char address[MAX_SOCK_ADDR];
int err;

sock = sockfd_lookup(fd, &err);
if (!sock)
goto out;
err = move_addr_to_kernel(uservaddr, addrlen, address);
if (err < 0)
goto out_put;

err = security_socket_connect(sock, (struct sockaddr )address, addrlen);
if (err) goto out_put;

err = sock->ops->connect(sock, (struct sockaddr ) address, addrlen,
sock->file->f_flags);
out_put:
sockfd_put(sock);
out:
return err;
}

跟其它 *** 作类似,sys_connect 接着调用 inet_connect:
/
Connect to a remote host There is regrettably still a little
TCP 'magic' in here
/
int inet_stream_connect(struct socket sock, struct sockaddr uaddr,
int addr_len, int flags)
{
struct sock sk = sock->sk;
int err;
long timeo;

lock_sock(sk);

if (uaddr->sa_family == AF_UNSPEC) {
err = sk->sk_prot->disconnect(sk, flags);
sock->state = err SS_DISCONNECTING : SS_UNCONNECTED;
goto out;
}

提交的协议簇不正确,则断开连接。

switch (sock->state) {
default:
err = -EINVAL;
goto out;
case SS_CONNECTED:
err = -EISCONN;
goto out;
case SS_CONNECTING:
err = -EALREADY;
/ Fall out of switch with err, set for this state /
break;[/code] socket 处于不正确的连接状态,返回相应的错误值。

case SS_UNCONNECTED:
err = -EISCONN;
if (sk->sk_state != TCP_CLOSE)
goto out;
/调用协议的连接函数/
err = sk->sk_prot->connect(sk, uaddr, addr_len);
if (err < 0)
goto out;
/协议方面的工作已经处理完成了,但是自己的一切工作还没有完成,所以切换至正在连接中/
sock->state = SS_CONNECTING;

/ Just entered SS_CONNECTING state; the only
difference is that return value in non-blocking
case is EINPROGRESS, rather than EALREADY
/
err = -EINPROGRESS;
break;
}

对于 TCP的实际的连接,是通过调用 tcp_v4_connect()函数来实现的。

二、tcp_v4_connect函数
对于 TCP 协议来说,其连接,实际上就是发送一个 SYN 报文,在服务器的应到到来时,回答它一个 ack 报文,也就是完成三次握手中的第一和第三次。

要发送 SYN 报文,也就是说,需要有完整的来源/目的地址,来源/目的端口,目的地址/端口由用户态提交,但是问题是没有自己的地址和端口,因为并没有调 用过 bind(2),一台主机,对于端口,可以像 sys_bind()那样,从本地未用端口中动态分配一个,那地址呢?因为一台主机可能会存在多个 IP地 址,如果随机动态选择,那么有可能选择一个错误的来源地址,将不能正确地到达目的地址。换句话说,来源地址的选择,是与路由相关的。

调用路由查找的核心函数 ip_route_output_slow(),在没有提供来源地址的情况下,会根据实际情况,调用 inet_select_addr()函数来选择一个合适的。同时,如果路由查找命中,会生成一个相应的路由缓存项,这个缓存项,不但对当前发送 SYN 报 文有意义,对于后续的所有数据包,都可以起到一个加速路由查找的作用。这一任务,是通过 ip_route_connect()函数完成的,它返回相应的路由缓存项(也就是说,来源地址也在其中了):

static inline int ip_route_connect(struct rtable rp, u32 dst,
u32 src, u32 tos, int oif, u8 protocol,
u16 sport, u16 dport, struct sock sk)
{ struct flowi fl = { oif = oif,
nl_u = { ip4_u = { daddr = dst,
saddr = src,
tos = tos } },
proto = protocol,
uli_u = { ports =
{ sport = sport,
dport = dport } } };

int err;
if (!dst || !src) {
err = __ip_route_output_key(rp, &fl);
if (err)
return err;
flfl4_dst = (rp)->rt_dst;
flfl4_src = (rp)->rt_src;
ip_rt_put(rp);
rp = NULL;
}
return ip_route_output_flow(rp, &fl, sk, 0);
}

首先,构建一个搜索 key fl,在搜索要素中,来源地址/端口是不存在的。所以,当通过__ip_route_output_key 进行查找时,第一次是不会命中缓存的。 __ip_route_output_key 将继续调用ip_route_output_slow()函数,在路由表中搜索,并返回一个合适的来源地址, 并且生成一个路由缓存项。 路由查找的更多细节,我会在另一个贴子中来分析。

/ This will initiate an outgoing connection /
int tcp_v4_connect(struct sock sk, struct sockaddr uaddr, int addr_len)
{
struct inet_sock inet = inet_sk(sk);
struct tcp_sock tp = tcp_sk(sk);
struct sockaddr_in usin = (struct sockaddr_in )uaddr;
struct rtable rt;
u32 daddr, nexthop;
int tmp;
int err;

if (addr_len < sizeof(struct sockaddr_in))
return -EINVAL;

if (usin->sin_family != AF_INET)
return -EAFNOSUPPORT;
校验地址长度和协议簇。
nexthop = daddr = usin->sin_addrs_addr;
将下一跳地址和目的地址的临时变量都暂时设为用户提交的地址。

if (inet->opt && inet->opt->srr) {
if (!daddr)
return -EINVAL;
nexthop = inet->opt->faddr;
}
如果使用了来源地址路由,选择一个合适的下一跳地址。

tmp = ip_route_connect(&rt, nexthop, inet->saddr,
RT_CONN_FLAGS(sk), sk->sk_bound_dev_if,
IPPROTO_TCP,
inet->sport, usin->sin_port, sk);
if (tmp < 0)
return tmp;

if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) {
ip_rt_put(rt);
return -ENETUNREACH;
}
进行路由查找,并校验返回的路由的类型,TCP是不被允许使用多播和广播的。

if (!inet->opt || !inet->opt->srr)
daddr = rt->rt_dst;
更新目的地址临时变量——使用路由查找后返回的值。

if (!inet->saddr)
inet->saddr = rt->rt_src;
inet->rcv_saddr = inet->saddr;
如果还没有设置源地址,和本地发送地址,则使用路由中返回的值。

if (tp->rx_optts_recent_stamp && inet->daddr != daddr) {
/ Reset inherited state /
tp->rx_optts_recent = 0;
tp->rx_optts_recent_stamp = 0;
tp->write_seq = 0;
}

if (sysctl_tcp_tw_recycle &&
!tp->rx_optts_recent_stamp && rt->rt_dst == daddr) {
struct inet_peer peer = rt_get_peer(rt);
/ VJ's idea We save last timestamp seen from
the destination in peer table, when entering state TIME-WAIT
and initialize rx_optts_recent from it, when trying new connection
/

if (peer && peer->tcp_ts_stamp + TCP_PAWS_MSL >= xtimetv_sec) {
tp->rx_optts_recent_stamp = peer->tcp_ts_stamp;
tp->rx_optts_recent = peer->tcp_ts;
}
}
这个更新初始状态方面的内容,还没有去分析它。

inet->dport = usin->sin_port;
inet->daddr = daddr;
保存目的地址及端口。

tp->ext_header_len = 0;
if (inet->opt)
tp->ext_header_len = inet->opt->optlen;

tp->rx_optmss_clamp = 536;
设置最小允许的 mss 值
tcp_set_state(sk, TCP_SYN_SENT);
套接字状态被置为 TCP_SYN_SENT,

err = tcp_v4_hash_connect(sk);
if (err)
goto failure;
动态选择一个本地端口,并加入 hash 表,与bind(2)选择端口类似。

err = ip_route_newports(&rt, inet->sport, inet->dport, sk);
if (err)
goto failure;

/ OK, now commit destination to socket /
__sk_dst_set(sk, &rt->udst);
tcp_v4_setup_caps(sk, &rt->udst);
因为本地端口已经改变,使用新端口,重新查找路由,并用新的路由缓存项更新 sk 中保存的路由缓存项。

if (!tp->write_seq)
tp->write_seq = secure_tcp_sequence_number(inet->saddr,
inet->daddr,
inet->sport,
usin->sin_port);
为 TCP报文计算一个 seq值(实际使用的值是 tp->write_seq+1)。

inet->id = tp->write_seq ^ jiffies;

err = tcp_connect(sk);
rt = NULL;
if (err)
goto failure;
return 0;
tp_connect()函数用来根据 sk 中的信息,构建一个完成的 syn 报文,并将它发送出去。在分析 tcp栈的实现时再来分析它。

根据 TCP协议,接下来的问题是,
1、可能收到了服务器的应答,则要回送一个 ack 报文;
2、如果超时还没有应答,则使用超时重发定时器;


欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/zz/13449966.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2025-09-01
下一篇2025-09-01

发表评论

登录后才能评论

评论列表(0条)

    保存