fossilcons 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  1. .TH FOSSILCONS 8
  2. .SH NAME
  3. fossilcons \- fossil console commands
  4. .SH SYNOPSIS
  5. .B
  6. con /srv/fscons
  7. .PP
  8. .PD 0.1
  9. .B .
  10. .I file
  11. .PP
  12. .B 9p
  13. .I T-message
  14. ...
  15. .PP
  16. .B dflag
  17. .PP
  18. .B echo
  19. [
  20. .B -n
  21. ]
  22. [
  23. .I arg
  24. ...
  25. ]
  26. .PP
  27. .B listen
  28. [
  29. .B -d
  30. ]
  31. [
  32. .I address
  33. ]
  34. .PP
  35. .B msg
  36. [
  37. .B -m
  38. .I nmsg
  39. ]
  40. [
  41. .B -p
  42. .I nproc
  43. ]
  44. .PP
  45. .B uname
  46. .I uname
  47. [
  48. .I uid
  49. |
  50. .BI : uid
  51. |
  52. .BI % newname
  53. |
  54. .BI = leader
  55. |
  56. .BI + member
  57. |
  58. .BI - member
  59. ]
  60. .PP
  61. .B users
  62. [
  63. .B -dw
  64. |
  65. .I file
  66. ]
  67. .PP
  68. .B srv
  69. [
  70. .B -dp
  71. ]
  72. .I name
  73. .sp
  74. .PP
  75. .B fsys
  76. .I name
  77. .PP
  78. .B fsys
  79. .I name
  80. .B config
  81. .I device
  82. .PP
  83. .B fsys
  84. .I name
  85. .B venti
  86. [
  87. .I host
  88. ]
  89. .PP
  90. .B fsys
  91. .I name
  92. .B open
  93. [
  94. .B -APWr
  95. ]
  96. [
  97. .B -c
  98. .I ncache
  99. ]
  100. .PP
  101. [
  102. .B fsys
  103. .I name
  104. ]
  105. .B close
  106. .PP
  107. .B fsys
  108. .I name
  109. .B unconfig
  110. .sp
  111. .PP
  112. [
  113. .B fsys
  114. .I name
  115. ]
  116. .B bfree
  117. .I addr
  118. .PP
  119. [
  120. .B fsys
  121. .I name
  122. ]
  123. .B block
  124. .I addr
  125. .I offset
  126. [
  127. .I count
  128. [
  129. .I data
  130. ]]
  131. .PP
  132. [
  133. .B fsys
  134. .I name
  135. ]
  136. .B clre
  137. .I addr
  138. .I offsets
  139. \&...
  140. .PP
  141. [
  142. .B fsys
  143. .I name
  144. ]
  145. .B clri
  146. .I files
  147. \&...
  148. .PP
  149. [
  150. .B fsys
  151. .I name
  152. ]
  153. .B clrp
  154. .I addr
  155. .I offset
  156. \&...
  157. .PP
  158. [
  159. .B fsys
  160. .I name
  161. ]
  162. .B create
  163. .I path
  164. .I uid
  165. .I gid
  166. .I perm
  167. .PP
  168. [
  169. .B fsys
  170. .I name
  171. ]
  172. .B epoch
  173. [
  174. .B -y
  175. ]
  176. .I n
  177. .PP
  178. [
  179. .B fsys
  180. .I name
  181. ]
  182. .B label
  183. .I addr
  184. [
  185. .I type
  186. .I state
  187. .I epoch
  188. .I epochclose
  189. .I tag
  190. ]
  191. .PP
  192. [
  193. .B fsys
  194. .I name
  195. ]
  196. .B remove
  197. .I files
  198. \&...
  199. .PP
  200. [
  201. .B fsys
  202. .I name
  203. ]
  204. .B snap
  205. [
  206. .B -a
  207. ]
  208. .PP
  209. [
  210. .B fsys
  211. .I name
  212. ]
  213. .B snaptime
  214. [
  215. .B -a
  216. .I hhmm
  217. ]
  218. [
  219. .B -s
  220. .I interval
  221. ]
  222. .PP
  223. [
  224. .B fsys
  225. .I name
  226. ]
  227. .B stat
  228. .IR files ...
  229. .PP
  230. [
  231. .B fsys
  232. .I name
  233. ]
  234. .B sync
  235. .PP
  236. [
  237. .B fsys
  238. .I name
  239. ]
  240. .B vac
  241. .I dir
  242. .PP
  243. [
  244. .B fsys
  245. .I name
  246. ]
  247. .B wstat
  248. .I file
  249. .I elem
  250. .I uid
  251. .I gid
  252. .I perm
  253. .I length
  254. .SH DESCRIPTION
  255. These are configuration and maintenance commands
  256. executed at the console of a
  257. .IR fossil (4)
  258. file server.
  259. The commands are split into three groups above:
  260. file server configuration,
  261. file system configuration,
  262. and file system maintenance.
  263. This manual page is split in the same way.
  264. .SS File server configuration
  265. .PP
  266. The
  267. dot
  268. .RI ( . )
  269. command
  270. reads
  271. .IR file ,
  272. treating each line as a command to be executed.
  273. Blank lines and lines beginning with a
  274. .L #
  275. character are ignored.
  276. Note that
  277. .I file
  278. is a file in the name space in which
  279. .I fossil
  280. was started,
  281. .I not
  282. a file in any file system served by
  283. .IR fossil .
  284. .PP
  285. .I 9p
  286. executes a 9P transaction; the arguments
  287. are in the same format used by
  288. .IR 9pcon (8).
  289. .PP
  290. .I Dflag
  291. toggles the debug flag and prints the new setting.
  292. When the debug flag is set, all protocol messages
  293. and information about authentication is printed to
  294. standard error.
  295. .PP
  296. .I Echo
  297. behaves identically to
  298. .IR echo (1),
  299. writing to the console.
  300. .PP
  301. .I Listen
  302. manages the network addresses at which
  303. fossil is listening.
  304. With no arguments,
  305. .I listen
  306. prints the current list of addresses and their network directories.
  307. With one argument, listen
  308. .I address
  309. starts a new listener at
  310. .IR address ;
  311. the
  312. .B -d
  313. flag causes
  314. .I listen
  315. to remove the listener
  316. at the given address.
  317. .PP
  318. .I Msg
  319. prints the maximum internal 9P message queue size
  320. and the maximum number of 9P processes to
  321. allocate for serving the queue.
  322. The
  323. .B -m
  324. and
  325. .B -p
  326. options set the two variables.
  327. .PP
  328. .I Uname
  329. displays or edits one entry the in-memory user table.
  330. If the in-memory table was read from a file
  331. (see the
  332. .I users
  333. command below),
  334. the new table is written to that file.
  335. There is no distinction between users and groups:
  336. a user is a group with one member.
  337. The user table records a mapping between
  338. uids and unames, as well as recording the
  339. leader and members of each group.
  340. A
  341. .I uid
  342. is a string naming a user or group
  343. and stored in the on-disk data structures.
  344. A
  345. .I uname
  346. is the string naming a user or group and
  347. used in 9P protocol messages.
  348. There is a distinction so that unames can be
  349. safely reused, even though uids cannot.
  350. The first argument to
  351. .I uname
  352. is (confusingly) a
  353. uname
  354. .RI ` uname .'
  355. The second argument is an optional verb, one of:
  356. .TP
  357. .I uid
  358. add the user with uname
  359. .RI ` uname '
  360. and uid
  361. .RI ` uid ,'
  362. creating a home directory
  363. .BI /active/usr/ uname \fR.
  364. .TP
  365. .BI : uid
  366. add the user but do not create the home directory
  367. .TP
  368. .BI % newname
  369. rename
  370. .RI ` uname '
  371. to
  372. .RI ` newname ,'
  373. throughout the user table
  374. .TP
  375. .BI = leader
  376. set the group leader to the uname
  377. .IR leader .
  378. .TP
  379. .BI + member
  380. add the uname
  381. .RI ` member '
  382. to the group
  383. .TP
  384. .BI - member
  385. remove the uname
  386. .RI ` member '
  387. from the group
  388. .LP
  389. If the verb is omitted, the entire entry for
  390. .I uname
  391. is printed, in the form:
  392. .IP
  393. .IB uid : uname : leader :\fImembers
  394. .LP
  395. where
  396. .I members
  397. is a comma-separated list of unames.
  398. .PP
  399. .I Users
  400. reads
  401. .IR file
  402. from the file system named
  403. .B main
  404. and uses it to initialize the user table.
  405. With no arguments,
  406. .I users
  407. prints the file name of the current user table.
  408. .PP
  409. The user table is a list of lines in the form printed
  410. by the
  411. .I uname
  412. command.
  413. The
  414. .B -d
  415. flag resets the user table to the default:
  416. .IP
  417. .EX
  418. adm:adm:adm:sys
  419. none:none::
  420. noworld:noworld::
  421. sys:sys::
  422. .EE
  423. .PP
  424. These users are mandatory and must appear in all user files read.
  425. It is not possible to rename these unames.
  426. .PP
  427. The
  428. .B -w
  429. flag causes the file
  430. .I /active/adm/users
  431. to be written with the current in-memory table.
  432. The path
  433. .I /active/adm
  434. must exist.
  435. .PP
  436. .I Srv
  437. behaves like listen but uses
  438. .BI /srv/ name
  439. rather than a network address.
  440. With the
  441. .B -p
  442. flag,
  443. .I srv
  444. edits a list of console services rather than 9P services.
  445. .SS File system configuration
  446. .I Fsys
  447. sets the current file system to
  448. .IR name ,
  449. which must be configured and open (q.v.).
  450. The current file system name is
  451. displayed as the file server prompt.
  452. .PP
  453. .I Fsys
  454. takes as an optional argument
  455. (after
  456. .BR name )
  457. a command to execute on the named file system.
  458. Most commands require that the named file system
  459. be configured and open; these commands can be invoked
  460. without the
  461. .BI fsys " name
  462. prefix, in which case the current file system is used.
  463. A few commands
  464. .RB ( config ,
  465. .BR open ,
  466. and
  467. .BR unconfig )
  468. operate on unopened file systems; they require the prefix.
  469. .PP
  470. .I Config
  471. creates a new file system named
  472. .I name
  473. using disk file
  474. .I device .
  475. This just adds an entry to fossil's internal table.
  476. .PP
  477. .I Venti
  478. establishes a connection to the Venti server
  479. .I host
  480. (by default, the environment variable
  481. .B $venti
  482. or the network variable
  483. .BR $venti )
  484. for use by the named file system.
  485. If no
  486. .I venti
  487. command is issued before
  488. .IR open ,
  489. the default Venti server will be used.
  490. If the file system is open, the command
  491. redials the Venti server.
  492. This can be used to reestablish broken connections.
  493. It is not a good idea to use the command to switch
  494. between Venti servers, since Fossil does not keep track
  495. of which blocks are stored on which servers.
  496. .PP
  497. .I Open
  498. opens the file system, reading the
  499. root and super blocks and allocating an in-memory
  500. cache for disk and Venti blocks.
  501. The options are:
  502. .TP
  503. .B -A
  504. run with no authentication
  505. .TP
  506. .B -P
  507. run with no permission checking
  508. .TP
  509. .B -W
  510. allow wstat to make arbitrary changes to the user and group fields
  511. .TP
  512. .B -r
  513. open the file system read-only
  514. .TP
  515. .BI -c " ncache
  516. allocate an in-memory cache of
  517. .I ncache
  518. (by default, 1000)
  519. blocks
  520. .PP
  521. .I Close
  522. flushes all dirty file system blocks to disk
  523. and then closes the device file.
  524. .PP
  525. .I Unconfig
  526. removes the named file system (which must be closed)
  527. from fossil's internal table.
  528. .SS File system maintenance
  529. .I Bfree
  530. marks the block at disk address
  531. .I addr
  532. as available for allocation.
  533. Before doing so, it prints a
  534. .I label
  535. command (q.v.)
  536. that can be used to restore the block to its previous state.
  537. .PP
  538. .I Block
  539. displays (in hexadecimal)
  540. the contents of the block at disk address
  541. .IR addr ,
  542. starting at
  543. .I offset
  544. and continuing for
  545. .I count
  546. bytes or until the end of the block.
  547. If
  548. .I data
  549. (also hexadecimal)
  550. is given, the contents in that range are
  551. replaced with data.
  552. When writing to a block,
  553. .I block
  554. prints the old and new contents,
  555. so that the change is easily undone.
  556. Editing blocks is discouraged.
  557. .PP
  558. .I Clre
  559. zeros an entry from a disk block.
  560. Before doing so, it prints a
  561. .I block
  562. command that can be used
  563. to restore the entry.
  564. .PP
  565. .I Clri
  566. removes the internal directory entry
  567. and abandons storage associated with
  568. .IR files .
  569. It ignores the usual rules for sanity, such as checking against
  570. removing a non-empty directory.
  571. A subsequent
  572. .I flchk
  573. (see
  574. .IR fossil (4))
  575. will identify the abandoned storage so it can be reclaimed with
  576. .I bfree
  577. commands.
  578. The
  579. .I perm
  580. is formatted as described in the
  581. .I stat
  582. command ;
  583. creating files or directories with the
  584. snapshot
  585. .RB ( s )
  586. bit set is not allowed.
  587. .PP
  588. .I Clrp
  589. zeros a pointer in a disk block.
  590. Before doing so, it prints a
  591. .I block
  592. command that can be used to restore the entry.
  593. .PP
  594. .I Create
  595. creates a file on the current file system.
  596. .I Uid
  597. and
  598. .I gid
  599. are uids
  600. .RI ( not
  601. unames;
  602. see the discussion above, in the description
  603. of the
  604. .I uname
  605. command).
  606. .I Perm
  607. is the low 9 bits of the permission mode of the file,
  608. in octal.
  609. The
  610. .BR -a ,
  611. .BR -d ,
  612. and
  613. .B -l
  614. flags set the append-only, directory, and lock bits.
  615. .PP
  616. .I Epoch
  617. sets the low file system epoch.
  618. Snapshots in the file system are given increasing epoch numbers.
  619. The file system maintains a low and a high epoch number,
  620. and only allows access to snapshots in that range.
  621. The low epoch number can be moved forward to discard old snapshots
  622. and reclaim the disk space they occupy.
  623. (The high epoch number is always the epoch of the currently
  624. active file system.)
  625. .PP
  626. The command
  627. ``\fLepoch\fI n''\fR
  628. is used to propose changing the low epoch to
  629. .IR n .
  630. In response,
  631. .I fossil
  632. scans
  633. .B /archive
  634. and
  635. .B /snapshot
  636. for snapshots that would be discarded, printing their
  637. epoch numbers and the
  638. .I clri
  639. commands necessary to remove them.
  640. The epoch is changed only if no such paths are found.
  641. The usual sequence of commands is (1) run epoch to
  642. print the snapshots and their epochs, (2) clri some snapshots,
  643. (3) run epoch again.
  644. If the file system is completely full (there are no free blocks),
  645. .I clri
  646. may fail because it needs to allocate blocks.
  647. For this situation,
  648. the
  649. .B -y
  650. flag to epoch forces the epoch change even when
  651. it means discarding currently accessible snapshots.
  652. Note that when there are still snapshots in
  653. .BR /archive ,
  654. the archiver should take care
  655. of those snapshots (moving the blocks from disk to Venti)
  656. if you give it more time.
  657. .PP
  658. .I Label
  659. displays and edits the label associated with a block.
  660. When editing, a parameter of
  661. .B -
  662. means leave that field unchanged.
  663. Editing labels is discouraged.
  664. .PP
  665. .I Remove
  666. removes
  667. .IR files .
  668. .PP
  669. .I Snap
  670. takes a temporary snapshot of the current file system,
  671. recording it in
  672. .BI /snapshot/ yyyy / mmdd / hhmm \fR,
  673. as described in
  674. .IR fossil (4).
  675. The
  676. .B -a
  677. flag causes
  678. .I snap
  679. to take an archival snapshot, recording it in
  680. .BI /archive/ yyyy / mmdd \fR,
  681. also described in
  682. .IR fossil (4).
  683. .PP
  684. .I Snaptime
  685. displays and edits the times at which snapshots are automatically
  686. taken.
  687. An archival snapshot is taken once a day, at
  688. .IR hhmm ,
  689. while temporary snapshots are taken at multiples of
  690. .I interval
  691. minutes.
  692. With no arguments,
  693. .I snaptime
  694. prints the current snapshot times.
  695. The
  696. .B -a
  697. and
  698. .B -s
  699. options set the archive and snapshot times.
  700. An
  701. .I hhmm
  702. or
  703. .I interval
  704. of
  705. .L none
  706. can be used to disable that kind of automatic snapshot.
  707. By default, both are disabled.
  708. .PP
  709. .I Stat
  710. displays metadata for each of the named
  711. .IR files ,
  712. in the form:
  713. .IP
  714. .EX
  715. stat \fIfile elem uid gid perm length
  716. .EE
  717. .LP
  718. (Replacing
  719. .B stat
  720. with
  721. .B wstat
  722. yields a valid command.)
  723. The
  724. .I perm
  725. is an octal number less than or equal to 777,
  726. prefixed with any of the following letters
  727. to indicate additional bits.
  728. .IP
  729. .EX
  730. .ta +4n
  731. a \fRappend only
  732. d \fRdirectory
  733. l \fRexclusive use
  734. s \fRis the root of a snapshot
  735. A \fRMS-DOS archive bit
  736. G \fRsetgid
  737. H \fRMS-DOS hidden bit
  738. L \fRsymbolic link
  739. S \fRMS-DOS system bit
  740. T \fRMS-DOS temporary bit
  741. U \fRsetuid
  742. Y \fRsticky
  743. .EE
  744. The bits denoted by capital letters are included
  745. to support non-Plan 9 systems.
  746. They are not made visible by the 9P protocol.
  747. .PP
  748. .I Sync
  749. writes dirty blocks in memory to the disk.
  750. .PP
  751. .I Vac
  752. prints the Venti score for a
  753. .IR vac (1)
  754. archive containing the tree rooted
  755. at
  756. .IR dir ,
  757. which must already be archived to Venti
  758. (typically
  759. .IR dir
  760. is a directory in the
  761. .B /archive
  762. tree).
  763. .PP
  764. .I Wstat
  765. changes the metadata of the named
  766. .IR file .
  767. Specifying
  768. .B -
  769. for any of the fields means ``don't change.''
  770. Attempts to change the
  771. .B d
  772. or
  773. .B s
  774. bits in the
  775. .I perm
  776. are silently ignored.
  777. .SH EXAMPLE
  778. .IR Sources ,
  779. the Plan 9 distribution file server,
  780. uses the following configuration file:
  781. .IP
  782. .EX
  783. srv -p fscons.sources
  784. srv -p fscons.sources.adduserd
  785. srv sources
  786. fsys main config /dev/sdC0/fossil.outside
  787. fsys main open -c 25600
  788. fsys main
  789. users /active/adm/users
  790. listen tcp!*!564
  791. msg -m 40 -p 10
  792. snaptime -a 0000 -s 15
  793. .EE
  794. .LP
  795. The second console is used by the daemon
  796. that creates new accounts.